-
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
Changes from all commits
64573c5
737e053
95c5160
a6543ff
fb84b90
0ba4415
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,21 +34,119 @@ export interface ToolbarGroupProps extends Omit<React.HTMLProps<HTMLDivElement>, | |
alignItems?: 'start' | 'center' | 'baseline' | 'default'; | ||
/** Vertical alignment */ | ||
alignSelf?: 'start' | 'center' | 'baseline' | 'default'; | ||
/** Spacers at various breakpoints. */ | ||
spacer?: { | ||
default?: 'spacerNone' | 'spacerSm' | 'spacerMd' | 'spacerLg'; | ||
md?: 'spacerNone' | 'spacerSm' | 'spacerMd' | 'spacerLg'; | ||
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. */ | ||
gap?: { | ||
default?: 'gapNone' | 'gapXs' | 'gapSm' | 'gapMd' | 'gapLg' | 'gapXl' | 'gap_2xl' | 'gap_3xl' | 'gap_4xl'; | ||
md?: 'gapNone' | 'gapXs' | 'gapSm' | 'gapMd' | 'gapLg' | 'gapXl' | 'gap_2xl' | 'gap_3xl' | 'gap_4xl'; | ||
lg?: 'gapNone' | 'gapXs' | 'gapSm' | 'gapMd' | 'gapLg' | 'gapXl' | 'gap_2xl' | 'gap_3xl' | 'gap_4xl'; | ||
xl?: 'gapNone' | 'gapXs' | 'gapSm' | 'gapMd' | 'gapLg' | 'gapXl' | 'gap_2xl' | 'gap_3xl' | 'gap_4xl'; | ||
'2xl'?: 'gapNone' | 'gapXs' | 'gapSm' | 'gapMd' | 'gapLg' | 'gapXl' | 'gap_2xl' | 'gap_3xl' | 'gap_4xl'; | ||
}; | ||
/** Space items at various breakpoints. */ | ||
spaceItems?: { | ||
default?: 'spaceItemsNone' | 'spaceItemsSm' | 'spaceItemsMd' | 'spaceItemsLg'; | ||
md?: 'spaceItemsNone' | 'spaceItemsSm' | 'spaceItemsMd' | 'spaceItemsLg'; | ||
lg?: 'spaceItemsNone' | 'spaceItemsSm' | 'spaceItemsMd' | 'spaceItemsLg'; | ||
xl?: 'spaceItemsNone' | 'spaceItemsSm' | 'spaceItemsMd' | 'spaceItemsLg'; | ||
'2xl'?: 'spaceItemsNone' | 'spaceItemsSm' | 'spaceItemsMd' | 'spaceItemsLg'; | ||
/** Sets only the column gap at various breakpoints. */ | ||
columnGap?: { | ||
default?: | ||
| 'columnGapNone' | ||
| 'columnGapXs' | ||
| 'columnGapSm' | ||
| 'columnGapMd' | ||
| 'columnGapLg' | ||
| 'columnGapXl' | ||
| 'columnGap_2xl' | ||
| 'columnGap_3xl' | ||
| 'columnGap_4xl'; | ||
Comment on lines
+54
to
+56
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. Just curious about the 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. This should be due to the missing hyphen in the margin classnames. Whatever logic 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. 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. |
||
md?: | ||
| 'columnGapNone' | ||
| 'columnGapXs' | ||
| 'columnGapSm' | ||
| 'columnGapMd' | ||
| 'columnGapLg' | ||
| 'columnGapXl' | ||
| 'columnGap_2xl' | ||
| 'columnGap_3xl' | ||
| 'columnGap_4xl'; | ||
lg?: | ||
| 'columnGapNone' | ||
| 'columnGapXs' | ||
| 'columnGapSm' | ||
| 'columnGapMd' | ||
| 'columnGapLg' | ||
| 'columnGapXl' | ||
| 'columnGap_2xl' | ||
| 'columnGap_3xl' | ||
| 'columnGap_4xl'; | ||
xl?: | ||
| 'columnGapNone' | ||
| 'columnGapXs' | ||
| 'columnGapSm' | ||
| 'columnGapMd' | ||
| 'columnGapLg' | ||
| 'columnGapXl' | ||
| 'columnGap_2xl' | ||
| 'columnGap_3xl' | ||
| 'columnGap_4xl'; | ||
'2xl'?: | ||
| 'columnGapNone' | ||
| 'columnGapXs' | ||
| 'columnGapSm' | ||
| 'columnGapMd' | ||
| 'columnGapLg' | ||
| 'columnGapXl' | ||
| 'columnGap_2xl' | ||
| 'columnGap_3xl' | ||
| 'columnGap_4xl'; | ||
}; | ||
/** Sets only the row gap at various breakpoints. */ | ||
rowGap?: { | ||
default?: | ||
| 'rowGapNone' | ||
| 'rowGapXs' | ||
| 'rowGapSm' | ||
| 'rowGapMd' | ||
| 'rowGapLg' | ||
| 'rowGapXl' | ||
| 'rowGap_2xl' | ||
| 'rowGao_3xl' | ||
| 'rowGap_4xl'; | ||
md?: | ||
| 'rowGapNone' | ||
| 'rowGapXs' | ||
| 'rowGapSm' | ||
| 'rowGapMd' | ||
| 'rowGapLg' | ||
| 'rowGapXl' | ||
| 'rowGap_2xl' | ||
| 'rowGao_3xl' | ||
| 'rowGap_4xl'; | ||
lg?: | ||
| 'rowGapNone' | ||
| 'rowGapXs' | ||
| 'rowGapSm' | ||
| 'rowGapMd' | ||
| 'rowGapLg' | ||
| 'rowGapXl' | ||
| 'rowGap_2xl' | ||
| 'rowGao_3xl' | ||
| 'rowGap_4xl'; | ||
xl?: | ||
| 'rowGapNone' | ||
| 'rowGapXs' | ||
| 'rowGapSm' | ||
| 'rowGapMd' | ||
| 'rowGapLg' | ||
| 'rowGapXl' | ||
| 'rowGap_2xl' | ||
| 'rowGao_3xl' | ||
| 'rowGap_4xl'; | ||
'2xl'?: | ||
| 'rowGapNone' | ||
| 'rowGapXs' | ||
| 'rowGapSm' | ||
| 'rowGapMd' | ||
| 'rowGapLg' | ||
| 'rowGapXl' | ||
| 'rowGap_2xl' | ||
| 'rowGao_3xl' | ||
| 'rowGap_4xl'; | ||
}; | ||
/** Content to be rendered inside the data toolbar group */ | ||
children?: React.ReactNode; | ||
|
@@ -65,8 +163,9 @@ class ToolbarGroupWithRef extends React.Component<ToolbarGroupProps> { | |
align, | ||
alignItems, | ||
alignSelf, | ||
spacer, | ||
spaceItems, | ||
gap, | ||
columnGap, | ||
rowGap, | ||
className, | ||
variant, | ||
children, | ||
|
@@ -84,8 +183,9 @@ class ToolbarGroupWithRef extends React.Component<ToolbarGroupProps> { | |
variant && styles.modifiers[toCamel(variant) as 'filterGroup' | 'iconButtonGroup'], | ||
formatBreakpointMods(visibility, styles, '', getBreakpoint(width)), | ||
formatBreakpointMods(align, styles, '', getBreakpoint(width)), | ||
formatBreakpointMods(spacer, styles, '', getBreakpoint(width)), | ||
formatBreakpointMods(spaceItems, styles, '', getBreakpoint(width)), | ||
formatBreakpointMods(gap, styles, '', getBreakpoint(width)), | ||
formatBreakpointMods(columnGap, styles, '', getBreakpoint(width)), | ||
formatBreakpointMods(rowGap, styles, '', getBreakpoint(width)), | ||
alignItems === 'start' && styles.modifiers.alignItemsStart, | ||
alignItems === 'center' && styles.modifiers.alignItemsCenter, | ||
alignItems === 'baseline' && styles.modifiers.alignItemsBaseline, | ||
|
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.