-
Notifications
You must be signed in to change notification settings - Fork 353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(Toolbar): add different gap props to examples #11440
Open
mfrances17
wants to merge
1
commit into
patternfly:main
Choose a base branch
from
mfrances17:toolbar-spacer-examples
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,46 +3,264 @@ import { Toolbar, ToolbarItem, ToolbarGroup, ToolbarContent } from '@patternfly/ | |
import { Button } from '@patternfly/react-core'; | ||
|
||
export const ToolbarSpacers: React.FunctionComponent = () => { | ||
const items = ( | ||
const groupGapItems = ( | ||
<React.Fragment> | ||
<ToolbarGroup variant="action-group"> | ||
<ToolbarItem> | ||
<Button variant="secondary">Action</Button> | ||
<Button variant="secondary">Default Gap</Button> | ||
</ToolbarItem> | ||
<ToolbarItem> | ||
<Button variant="secondary">Action</Button> | ||
<Button variant="secondary">Default Gap</Button> | ||
</ToolbarItem> | ||
</ToolbarGroup> | ||
<ToolbarItem variant="separator"></ToolbarItem> | ||
<ToolbarGroup variant="action-group" gap={{ default: 'gapNone' }}> | ||
<ToolbarItem> | ||
<Button variant="secondary">Action</Button> | ||
<Button variant="secondary">No Gap</Button> | ||
</ToolbarItem> | ||
<ToolbarItem> | ||
<Button variant="secondary">Action</Button> | ||
<Button variant="secondary">No Gap</Button> | ||
</ToolbarItem> | ||
</ToolbarGroup> | ||
<ToolbarItem variant="separator"></ToolbarItem> | ||
<ToolbarGroup variant="action-group" gap={{ lg: 'gapSm' }}> | ||
<ToolbarGroup variant="action-group" gap={{ default: 'gapSm' }}> | ||
<ToolbarItem> | ||
<Button variant="secondary">Action</Button> | ||
<Button variant="secondary">Small Gap</Button> | ||
</ToolbarItem> | ||
<ToolbarItem> | ||
<Button variant="primary">Action</Button> | ||
<Button variant="secondary">Small Gap</Button> | ||
</ToolbarItem> | ||
</ToolbarGroup> | ||
<ToolbarItem variant="separator"></ToolbarItem> | ||
<ToolbarGroup variant="action-group" gap={{ lg: 'gapLg' }}> | ||
<ToolbarGroup variant="action-group" gap={{ default: 'gapXl' }}> | ||
<ToolbarItem> | ||
<Button variant="secondary">Extra Large Gap</Button> | ||
</ToolbarItem> | ||
<ToolbarItem> | ||
<Button variant="secondary">Extra Large Gap</Button> | ||
</ToolbarItem> | ||
</ToolbarGroup> | ||
</React.Fragment> | ||
); | ||
|
||
const groupColumnGapItems = ( | ||
<React.Fragment> | ||
<ToolbarGroup variant="action-group" columnGap={{ default: 'columnGapNone' }}> | ||
<ToolbarItem className="pf-m-wrap"> | ||
<Button variant="secondary">No Column Gap</Button> | ||
</ToolbarItem> | ||
<ToolbarItem> | ||
<Button variant="secondary">No Column Gap</Button> | ||
</ToolbarItem> | ||
</ToolbarGroup> | ||
<ToolbarItem variant="separator"></ToolbarItem> | ||
<ToolbarGroup variant="action-group" columnGap={{ default: 'columnGapSm' }}> | ||
<ToolbarItem className="pf-m-wrap"> | ||
<Button variant="secondary">Small Column Gap</Button> | ||
</ToolbarItem> | ||
<ToolbarItem> | ||
<Button variant="secondary">Small Column Gap</Button> | ||
</ToolbarItem> | ||
</ToolbarGroup> | ||
<ToolbarItem variant="separator"></ToolbarItem> | ||
<ToolbarGroup variant="action-group" columnGap={{ default: 'columnGapXl' }}> | ||
<ToolbarItem className="pf-m-wrap"> | ||
<Button variant="secondary">Extra Large Column Gap</Button> | ||
</ToolbarItem> | ||
<ToolbarItem> | ||
<Button variant="secondary">Extra Large Column Gap</Button> | ||
</ToolbarItem> | ||
</ToolbarGroup> | ||
</React.Fragment> | ||
); | ||
|
||
const groupRowGapItems = ( | ||
<React.Fragment> | ||
<ToolbarGroup className="pf-m-wrap" variant="action-group" rowGap={{ default: 'rowGapNone' }}> | ||
<ToolbarItem> | ||
<Button variant="secondary">No Row Gap</Button> | ||
</ToolbarItem> | ||
<ToolbarItem> | ||
<Button variant="secondary">No Row Gap</Button> | ||
</ToolbarItem> | ||
<ToolbarItem> | ||
<Button variant="secondary">No Row Gap</Button> | ||
</ToolbarItem> | ||
<ToolbarItem> | ||
<Button variant="secondary">No Row Gap</Button> | ||
</ToolbarItem> | ||
<ToolbarItem> | ||
<Button variant="secondary">No Row Gap</Button> | ||
</ToolbarItem> | ||
<ToolbarItem> | ||
<Button variant="secondary">No Row Gap</Button> | ||
</ToolbarItem> | ||
<ToolbarItem> | ||
<Button variant="secondary">No Row Gap</Button> | ||
</ToolbarItem> | ||
<ToolbarItem> | ||
<Button variant="secondary">No Row Gap</Button> | ||
</ToolbarItem> | ||
<ToolbarItem variant="separator"></ToolbarItem> | ||
</ToolbarGroup> | ||
<ToolbarGroup className="pf-m-wrap" variant="action-group" rowGap={{ default: 'rowGapSm' }}> | ||
<ToolbarItem> | ||
<Button variant="secondary">Small Row Gap</Button> | ||
</ToolbarItem> | ||
<ToolbarItem> | ||
<Button variant="secondary">Small Row Gap</Button> | ||
</ToolbarItem> | ||
<ToolbarItem> | ||
<Button variant="secondary">Action</Button> | ||
<Button variant="secondary">Small Row Gap</Button> | ||
</ToolbarItem> | ||
<ToolbarItem> | ||
<Button variant="secondary">Action</Button> | ||
<Button variant="secondary">Small Row Gap</Button> | ||
</ToolbarItem> | ||
<ToolbarItem> | ||
<Button variant="secondary">Small Row Gap</Button> | ||
</ToolbarItem> | ||
<ToolbarItem> | ||
<Button variant="secondary">Small Row Gap</Button> | ||
</ToolbarItem> | ||
<ToolbarItem> | ||
<Button variant="secondary">Small Row Gap</Button> | ||
</ToolbarItem> | ||
<ToolbarItem> | ||
<Button variant="secondary">Small Row Gap</Button> | ||
</ToolbarItem> | ||
<ToolbarItem variant="separator"></ToolbarItem> | ||
</ToolbarGroup> | ||
<ToolbarGroup className="pf-m-wrap" variant="action-group" rowGap={{ default: 'rowGapXl' }}> | ||
<ToolbarItem> | ||
<Button variant="secondary">Extra Large Row Gap</Button> | ||
</ToolbarItem> | ||
<ToolbarItem> | ||
<Button variant="secondary">Extra Large Row Gap</Button> | ||
</ToolbarItem> | ||
<ToolbarItem> | ||
<Button variant="secondary">Extra Large Row Gap</Button> | ||
</ToolbarItem> | ||
<ToolbarItem> | ||
<Button variant="secondary">Extra Large Row Gap</Button> | ||
</ToolbarItem> | ||
<ToolbarItem> | ||
<Button variant="secondary">Extra Large Row Gap</Button> | ||
</ToolbarItem> | ||
<ToolbarItem> | ||
<Button variant="secondary">Extra Large Row Gap</Button> | ||
</ToolbarItem> | ||
<ToolbarItem> | ||
<Button variant="secondary">Extra Large Row Gap</Button> | ||
</ToolbarItem> | ||
<ToolbarItem> | ||
<Button variant="secondary">Extra Large Row Gap</Button> | ||
</ToolbarItem> | ||
</ToolbarGroup> | ||
</React.Fragment> | ||
); | ||
|
||
const itemGapItems = ( | ||
<React.Fragment> | ||
<ToolbarGroup className="pf-m-wrap" variant="action-group"> | ||
<ToolbarItem gap={{ default: 'gapNone' }}> | ||
<Button variant="secondary">No Gap</Button> | ||
<Button variant="secondary">No Gap</Button> | ||
</ToolbarItem> | ||
<ToolbarItem variant="separator"></ToolbarItem> | ||
<ToolbarItem gap={{ default: 'gapSm' }}> | ||
<Button variant="secondary">Small Gap</Button> | ||
<Button variant="secondary">Small Gap</Button> | ||
</ToolbarItem> | ||
<ToolbarItem variant="separator"></ToolbarItem> | ||
<ToolbarItem gap={{ default: 'gapXl' }}> | ||
<Button variant="secondary">Extra Large Gap</Button> | ||
<Button variant="secondary">Extra Large Gap</Button> | ||
</ToolbarItem> | ||
</ToolbarGroup> | ||
</React.Fragment> | ||
); | ||
|
||
const itemColumnGapItems = ( | ||
<React.Fragment> | ||
<ToolbarGroup className="pf-m-wrap" variant="action-group"> | ||
<ToolbarItem columnGap={{ default: 'columnGapNone' }}> | ||
<Button variant="secondary">No Column Gap</Button> | ||
<Button variant="secondary">No Column Gap</Button> | ||
</ToolbarItem> | ||
<ToolbarItem variant="separator"></ToolbarItem> | ||
<ToolbarItem columnGap={{ default: 'columnGapSm' }}> | ||
<Button variant="secondary">Small Column Gap</Button> | ||
<Button variant="secondary">Small Column Gap</Button> | ||
</ToolbarItem> | ||
<ToolbarItem variant="separator"></ToolbarItem> | ||
<ToolbarItem columnGap={{ default: 'columnGapXl' }}> | ||
<Button variant="secondary">Extra Large Column Gap</Button> | ||
<Button variant="secondary">Extra Large Column Gap</Button> | ||
</ToolbarItem> | ||
</ToolbarGroup> | ||
</React.Fragment> | ||
); | ||
|
||
const itemRowGapItems = ( | ||
<React.Fragment> | ||
<ToolbarGroup variant="action-group"> | ||
<ToolbarItem className="pf-m-wrap" rowGap={{ default: 'rowGapNone' }}> | ||
<Button variant="secondary">No Row Gap</Button> | ||
<Button variant="secondary">No Row Gap</Button> | ||
</ToolbarItem> | ||
<ToolbarItem variant="separator"></ToolbarItem> | ||
<ToolbarItem className="pf-m-wrap" rowGap={{ default: 'rowGapSm' }}> | ||
<Button variant="secondary">Small Row Gap</Button> | ||
<Button variant="secondary">Small Row Gap</Button> | ||
</ToolbarItem> | ||
<ToolbarItem variant="separator"></ToolbarItem> | ||
<ToolbarItem className="pf-m-wrap" rowGap={{ default: 'rowGapXl' }}> | ||
<Button variant="secondary">Extra Large Row Gap</Button> | ||
<Button variant="secondary">Extra Large Row Gap</Button> | ||
</ToolbarItem> | ||
</ToolbarGroup> | ||
</React.Fragment> | ||
); | ||
|
||
return ( | ||
<Toolbar id="toolbar-spacers"> | ||
<ToolbarContent>{items}</ToolbarContent> | ||
</Toolbar> | ||
<> | ||
<strong>Toolbar Group Spacing:</strong> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rather than the strong element, can we update this to use the h4 heading for this and the "Toolbar item spacing"? Could also add a "Using gap" above the first set similar to "Using column gap" and "Using row gap" for the other sets. |
||
<br /> | ||
<br /> | ||
<Toolbar id="toolbar-spacers"> | ||
<ToolbarContent>{groupGapItems}</ToolbarContent> | ||
</Toolbar> | ||
<strong>Using column gap</strong> | ||
<br /> | ||
<br /> | ||
<Toolbar id="toolbar-spacers"> | ||
<ToolbarContent>{groupColumnGapItems}</ToolbarContent> | ||
</Toolbar> | ||
<strong>Using row gap</strong> | ||
<br /> | ||
<br /> | ||
<Toolbar id="toolbar-spacers"> | ||
<ToolbarContent>{groupRowGapItems}</ToolbarContent> | ||
</Toolbar> | ||
<br /> | ||
<strong>Toolbar Item Spacing:</strong> | ||
<br /> | ||
<br /> | ||
<Toolbar id="toolbar-spacers"> | ||
<ToolbarContent>{itemGapItems}</ToolbarContent> | ||
</Toolbar> | ||
<strong>Using column gap</strong> | ||
<br /> | ||
<br /> | ||
<Toolbar id="toolbar-spacers"> | ||
<ToolbarContent>{itemColumnGapItems}</ToolbarContent> | ||
</Toolbar> | ||
<strong>Using row gap</strong> | ||
<br /> | ||
<br /> | ||
<Toolbar id="toolbar-spacers"> | ||
<ToolbarContent>{itemRowGapItems}</ToolbarContent> | ||
</Toolbar> | ||
</> | ||
); | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we double check these classes? The ones on a ToolbarGroup should be fine, but not sure if we need them on all of the ToolbarItems (do see that for the row gap section it's being used to show off the row gap on ToolbarItem, though).
Also @mcoker, is the intent that only Toolbar subcomponents will be passed into a ToolbarGroup, or could, say, a plain div be passed and in that div are ToolbarItems? Right now there's no easier way to apply wrapping to a ToolbarGroup and better show the row gap in use than hardcoding this class name. Should there be a prop to apply wrapping?