Skip to content
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

Merged
merged 6 commits into from
May 23, 2024

Conversation

thatblindgeye
Copy link
Contributor

@thatblindgeye thatblindgeye commented May 22, 2024

What: Closes #10387

Couple notes (in addition to the one below in another comment):

  • 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.
  • May be worth a followup at some point (not necessarily for v6) to simplify the API in terms of these new/replacement props. `gapNone" etc end up verbose, and it'd be great if we could simplify it to just "none" and so on.

Additional issues:

@thatblindgeye thatblindgeye requested review from mcoker, a team, tlabaj and kmcfaul and removed request for a team May 22, 2024 17:41
| 'rowGap_4xl';
};
/** Sets the margin-inline-start at various breakpoints. */
marginInlineStart?: {
Copy link
Contributor Author

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@patternfly-build
Copy link
Contributor

patternfly-build commented May 22, 2024

Copy link
Contributor

@mcoker mcoker left a 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.

Comment on lines +54 to +56
| 'columnGap_2xl'
| 'columnGap_3xl'
| 'columnGap_4xl';
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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 thatblindgeye linked an issue May 23, 2024 that may be closed by this pull request
5 tasks
@mcoker
Copy link
Contributor

mcoker commented May 23, 2024

@thatblindgeye confirmed with @mattnolting that we don't want to include the .pf-m-margin* modifiers, and we can remove them from the core CSS before beta. If we can take them out of this PR, I think it's good-to-go!

Copy link
Contributor

@mcoker mcoker left a 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)

@thatblindgeye
Copy link
Contributor Author

Followup regarding adding new examples: #10432

Copy link
Contributor

@mcoker mcoker left a 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".
Copy link
Contributor

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?

Copy link
Contributor Author

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. */
Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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>
Copy link
Contributor

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?

Copy link
Contributor

@tlabaj tlabaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tlabaj tlabaj merged commit 29578a2 into patternfly:v6 May 23, 2024
13 checks passed
@evwilkin
Copy link
Member

@thatblindgeye @tlabaj see this just merged but wanted to note that all the 'rowGap_3xl' usages in this code have a typo of 'rowGao_3xl'

@patternfly-build
Copy link
Contributor

Your changes have been released in:

Thanks for your contribution! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Toolbar - spacer/gap updates
6 participants