-
Notifications
You must be signed in to change notification settings - Fork 355
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
feat(Toolbar): updated spacer props to gap #10418
Conversation
| 'rowGap_4xl'; | ||
}; | ||
/** Sets the margin-inline-start at various breakpoints. */ | ||
marginInlineStart?: { |
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.
Just a note, right now this and the marginInlineEnd props won't work correctly due to the styles object casing. Instead of marginInlineStartNone
for example, we need to pass marginInlineStartnone
(lowercased "none").
I can update this PR to use the lowercased size, but I opted to keep the intended (?) prop values in case we can get a quick Core update in to maybe help resolve this
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.
@thatblindgeye added a PR to fix patternfly/patternfly#6684 (cc @mattnolting)
Preview: https://patternfly-react-pr-10418.surge.sh A11y report: https://patternfly-react-pr-10418-a11y.surge.sh |
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.
LGTM! One question about the use of _
in the prop values, though I'd like to get clarification from @mattnolting on a couple of things from https://github.com/patternfly/patternfly/pull/6057/files
- Can you provide some detail on the
.pf-m-margin*
classes? They can provide the same functionality the current spacer system provides, but I don't see them included in the issue description or mentioned/used in the core docs, so want to make sure they're intentional before we add them to the react component and have users update to use them. -
I imagine we'll want to add these same props onto ToolbarContent since Core supports it. Opted to not include it here since we don't currently, and the API may be even more verbose since we currently don't have a separate ContentSection component. So we may end up needing props like gap, sectionGap and so on.
- Is there any functionality for the toolbar and/or other components that use toolbar to add the spacer system to
<ToolbarContent>
? If not and it wasn't a requested feature/enhancement, I wonder if we can remove the CSS and just add that later if it's requested, since it may not be a straight forward addition to the react component.
- Is there any functionality for the toolbar and/or other components that use toolbar to add the spacer system to
| 'columnGap_2xl' | ||
| 'columnGap_3xl' | ||
| 'columnGap_4xl'; |
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.
Just curious about the _
in the values. I don't see them in the margin*
props. And we have a very similar spacing system in the flex layout and the props/values look identical (at first glance) except for the _
and wondering if that should be consistent?
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.
This should be due to the missing hyphen in the margin classnames. Whatever logic camel-case
has (which react-styles is using to build these maps) essentially replaces hyphens with underscores if the order is letter + hyphen + number.
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.
Hmm... I'm not sure I understand how these values are tied to the margin modifiers? And why only the ones that start with numbers are prefixed with an underscore.
@thatblindgeye confirmed with @mattnolting that we don't want to include the |
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.
Just leaving an official review for the change to drop the marginInline*
props from this comment #10418 (comment)
Followup regarding adding new examples: #10432 |
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.
LGTM! Great work @thatblindgeye and thanks for jumping on this so quickly.
@@ -28,7 +28,7 @@ Note: This example does not demonstrate responsive toolbar behavior. Responsive | |||
|
|||
You may adjust the space between toolbar items to arrange them into groups. Read our spacers documentation to learn more about using spacers. | |||
|
|||
Items are spaced “16px” apart by default. To adjust the size of the space between items, use the `spacer` property of each `<ToolbarItem>`. You can set the `spacer` value at multiple breakpoints, including "default", "md", "lg", "xl", and "2xl". Available `spacer` values include "spacerNone", "spacerSm", "spacerMd", or "spacerLg" into each breakpoint. | |||
Items are spaced “16px” apart by default via their parents' `gap` or `columnGap` property. You can set the property values at multiple breakpoints, including "default", "md", "lg", "xl", and "2xl". |
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.
should there be a blurb about rowGap somewhere?
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.
I opened a followup for additional examples as well as updating this example: #10432
lg?: 'spacerNone' | 'spacerSm' | 'spacerMd' | 'spacerLg'; | ||
xl?: 'spacerNone' | 'spacerSm' | 'spacerMd' | 'spacerLg'; | ||
'2xl'?: 'spacerNone' | 'spacerSm' | 'spacerMd' | 'spacerLg'; | ||
/** Sets both the column and row gap at various breakpoints. */ |
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.
Not a blocker, but I would update/ add unit test to verify that formatBreakpointMods
formats all the values accurately.
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.
Could this be tackled as part of #7594?
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.
It can, as long as we at least test them manually.
@@ -5,34 +5,27 @@ import { Button } from '@patternfly/react-core'; | |||
export const ToolbarSpacers: React.FunctionComponent = () => { | |||
const items = ( | |||
<React.Fragment> | |||
<ToolbarItem spacer={{ default: 'spacerNone' }}> | |||
<ToolbarItem> |
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.
Nit. Should we rename this file to ToolbarGaps?
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.
LGTM
@thatblindgeye @tlabaj see this just merged but wanted to note that all the |
Your changes have been released in:
Thanks for your contribution! 🎉 |
What: Closes #10387
Couple notes (in addition to the one below in another comment):
gap
,sectionGap
and so on.Additional issues: