| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Codecov Report
@@ Coverage Diff @@
## master #3144 +/- ##
==========================================
- Coverage 69.03% 68.98% -0.05%
==========================================
Files 859 858 -1
Lines 23637 23627 -10
Branches 1895 1893 -2
==========================================
- Hits 16318 16300 -18
- Misses 6359 6366 +7
- Partials 960 961 +1
Continue to review full report at Codecov.
|
Sorry, something went wrong.
|
PatternFly-React preview: https://patternfly-react-pr-3144.surge.sh |
Sorry, something went wrong.
There was a problem hiding this comment.
I'm wondering if the toggle props can be simplified?
Sorry, something went wrong.
| /** Flag indicating the if the expandable content's expanded state is consumer managed or not */ | ||
| isConsumerManagedToggleGroup: boolean; | ||
| /** Flag indicating if the component managed state has expanded content or not */ | ||
| componentManagedIsExpanded: boolean; |
There was a problem hiding this comment.
The isConsumerManagedToggleGroup and componentManagedIsExpanded names are a little confusing to me.
Perhaps something more like isToggleManaged would suffice?
Sorry, something went wrong.
There was a problem hiding this comment.
I'm struggling with the componentManagedIsExpanded name. Couldn't a user use isExpanded directly, when isConsumerManagedToggleGroup is in use?
Could this be simplified at all?
Sorry, something went wrong.
There was a problem hiding this comment.
I will change the names of the isConsumerManagedToggleGroup and componentManagedIsExpanded to try and clear it up some.
Basically, I allow the consumer to control the expanded state of the DataToolbarContentGroup by passing isExpanded and toggleIsExpanded as props. If they are not provided by the consumer, then both are managed internally by the component. That was what I was trying to communicate. I use the state to track whether or not the user has provided those props - thus wants to manage the expanded state of the toggle group themself.
In the react docs I do try to provide a write up explaining some of that. Maybe that clears it up some? I could add more of that into the comments of the component code for the sake of the developers in the future.
Sorry, something went wrong.
There was a problem hiding this comment.
Storing isToggleManaged in state seems like an antipattern to me, since it is something derived from props. If those props were to change, the state wouldn't update. Since the component will probably never go from managed to unmanaged or vice versa while it is mounted (I don't see why a consumer would do that) it's probably fine here, but I could see this pattern causing bugs if used elsewhere. Instead maybe putting that logic in a method and calling this.isToggleManaged() wherever you need to check that would be better.
Sorry, something went wrong.
There was a problem hiding this comment.
oh I see
Sorry, something went wrong.
| isExpanded: isConsumerManagedToggleGroup ? isExpanded : componentManagedIsExpanded, | ||
| toggleIsExpanded: isConsumerManagedToggleGroup ? toggleIsExpanded : this.toggleIsExpanded, | ||
| expandableContentRef: this.expandableContentRef, | ||
| expandableContentId |
There was a problem hiding this comment.
It's difficult to understand the difference between isExpanded, toggleIsExpanded, expandableContent*, etc. It would be good to simplify / clarify these names.
Sorry, something went wrong.
| /** Content to be rendered as children of the content row */ | ||
| children?: React.ReactNode; | ||
| /** Flag indicating if a Data toolbar toggle group's expandable content is expanded */ | ||
| isExpanded?: boolean; |
There was a problem hiding this comment.
Is this for the toggle group or content? The description, "toggle group's expandable content is expanded" sounds confusing to me.
Considering there is a toggleIsExpanded prop below, perhaps something more like isContentExpanded would help to clarify the use case?
Sorry, something went wrong.
There was a problem hiding this comment.
so the toggle group has an associated expandable content that is what gets expanded or collapsed when the toggle icon in the toggle group is clicked. It is confusing. I feel passing an isExpanded flag as a prop to the DataToolbarToggleGroup is the clearest way to state it. Do you have another idea?
Sorry, something went wrong.
There was a problem hiding this comment.
It appears that we have two sets of properties, one set managed by the consumer and another internally managed. My thought was that we could use the same props internally, if isConsumerManagedToggleGroup is not provided?
I don't feel strongly about it, just somewhat confusing. I didn't see the react docs, so clarifying the comments would be helpful.
Sorry, something went wrong.
There was a problem hiding this comment.
isConsumerManagedToggleGroup is a state field calculated based on whether or not the consumer provided isExpanded and the toggleIsExpanded handler, not a passed prop. But I will rename it to isToggleManaged and make the comments clearer?
Sorry, something went wrong.
There was a problem hiding this comment.
gotcha
Sorry, something went wrong.
There was a problem hiding this comment.
Good to see the progress on this @nicolethoen . Just a few questions/comments:
It still looks like we are not applying the latest styling from core. I'm specifically looking at the search fields which should pick up the revised input group styling.
The way the toolbar responds as I shrink the viewport in the examples is not consistent with the design intent. See the section on Responsive toolbar here: https://www.patternfly.org/v4/design-guidelines/usage-and-behavior/toolbar. Maybe this is OK for these examples and we should build something more like a Toolbar demo that responds correctly. Not sure. Perhaps we didn't address this fully in core. @mattnolting what are your thoughts? Should we be using the Overflow component in the place of just groups of buttons?
Without more documentation, I'm not sure that the examples here have enough context. Do we need to explain the spacing system? I tried to do that in the design documentation (linked above) so maybe we just need to reference that?
In short, I think what's implemented here meets the goal to better match the core examples and I don't have a problem accepting this PR. But I just wonder if the examples will be enough on their own to give developer guidance. Thoughts @LHinson @rachael-phillips @dgutride ?
Sorry, something went wrong.
Good catch, I had to make a code change to apply the new style for inputGroup. I guess that was a change made after I first used the InputGroups in the examples.
If you are referring to the groups of buttons in the first few examples. Those examples are not demonstrating the responsive behavior of the toolbar, they are demonstrating the spacing between items and groups of items and how that can be manipulated. As far as I understand, the responsive solution in the toolbar is heavily tied to the Toggle Group, so that is not used or demonstrated until later examples. Is there something else that is missing?
I'm happy to add more text - when doing my own poking around, it didn't seem that the react examples tended to include a grand deal of explanation. So I assumed that we expected consumers to look elsewhere for design decision explanation and such - but I can definitely see how more text is useful to a developer. If no one sees a problem with adding more information. I'll do that. |
Sorry, something went wrong.
Upon further thinking, I guess this is OK. Maybe this would be solved if there was some documentation that describes the purpose of those examples. I just didn't want someone to look at this and think it was the responsive behavior that we want (with everything wrapping to multi-lines). |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM
Sorry, something went wrong.
There was a problem hiding this comment.
Looks great @nicolethoen . Thanks for adding the documentation. I think that helps a lot.
Sorry, something went wrong.
| showClearFiltersButton: boolean; | ||
| /** Flag indicating if a Data toolbar toggle group's expandable content is expanded */ | ||
| expandableContentIsExpanded: boolean; | ||
| /** Text to display in the Clear all filters button */ |
There was a problem hiding this comment.
can you make this sentence case. That goes for all prop descriptions.
Sorry, something went wrong.
| @@ -16,40 +17,73 @@ export interface DataToolbarChipGroupContentProps extends React.HTMLProps<HTMLDi | |||
| clearAllFilters?: () => void; | |||
| /** Flag indicating that the Clear all filters button should be visible */ | |||
There was a problem hiding this comment.
can you make this sentence case.
Sorry, something went wrong.
|
@mattnolting |
Sorry, something went wrong.
|
@nicolethoen yes, .pf-m-expanded is applied to pf-c-data-toolbar__toggle when expanded. CSS is there to support |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM!
Sorry, something went wrong.
There was a problem hiding this comment.
Sorry, something went wrong.
| { | ||
| showClearFiltersButton && !isExpanded && | ||
| <DataToolbarItem className={css(getModifier(styles, 'clear'))}> | ||
| <Button variant="link" onClick={clearChipGroups}> |
There was a problem hiding this comment.
| <Button variant="link" onClick={clearChipGroups}> | |
| <Button variant="link" onClick={clearChipGroups} isInline> |
Sorry, something went wrong.
There was a problem hiding this comment.
Sorry, something went wrong.
There was a problem hiding this comment.
🌯 🌯
Sorry, something went wrong.
There was a problem hiding this comment.
🌯 🌯 🌯
Sorry, something went wrong.
There was a problem hiding this comment.
Fantastic work @nicolethoen! 👍
Don't need pf-m-align-right here: https://github.com/patternfly/patternfly-react/pull/3144/files#diff-71a8fa8b3d9c6597956a184e3718d8c1R1028
Sorry, something went wrong.
…aToolbarContent state names
…whenever there are no chips to display
There was a problem hiding this comment.
Fantastic! LGTM. Thanks for your hard work @nicolethoen!
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Addresses issue #3097
Addresses #3046
Implements changes made to core in this PR #2342