Skip to content

Conversation

@nicolethoen
Copy link
Contributor

@nicolethoen nicolethoen commented Sep 6, 2019

@patternfly-build
Copy link
Collaborator

PatternFly-React preview: https://patternfly-react-pr-2861.surge.sh

Copy link
Contributor

@karelhala karelhala left a comment

Choose a reason for hiding this comment

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

Thank you so much for this PR! It's a great start, we just have to remove the isExpanded from state and some variable renames and we are good to go!

}

componentDidMount() {
window.addEventListener('resize', this.closeExpandableContent);
Copy link
Contributor

Choose a reason for hiding this comment

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

Please do not listen on resize events and close expandable content. This is css breakpoints work, no need to close the content on each window resize. It adds performance issues and plus unwanted behavior.

Copy link
Contributor

Choose a reason for hiding this comment

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

@karelhala There's an issue where if the toggle drawer is open and the window is resized when the breakpoint is hit the content will not layout correctly. We're looking for a solution to make it behave the same way that dropdown does. Will look at that code to see how that one works to see if there's a better solution.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is really unaesthetic because imagine that you are looking at table with this on mobile, click on the expand button, realise that landscape view might be better for this and once you flip the phone this expanded menu is lost and user has to click on it once again.

If the layout is not rendered correctly on window resize I think that is more of a issue in PF core and we shouldn't try to fix it here.

Copy link
Contributor

Choose a reason for hiding this comment

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

@mcarrano Any thoughts on the behavior with the toggle?

Copy link
Member

Choose a reason for hiding this comment

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

This is a tough one to answer because it's not clear what the best approach is. I agree that just collapsing the drawer on resize it not great. Maybe if the drawer is open and a breakpoint is crossed, the content should not reconfigure itself (i.e. suppress the behavior in this case). Is that even possible? @mattnolting any thoughts here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mcarrano - matt nolting is on PTO until Tuesday.

regarding that being possible, yes I believe it is, but we'd have to use the breakpoint passed in by the user and look up the global size of that breakpoint and make it reconfigure itself based on the global size (hopefully no one will have over written it). I may not have time to figure that out today - but I can try. Would that be an acceptable approach @dlabaj?

Copy link
Contributor

@mattnolting mattnolting Sep 10, 2019

Choose a reason for hiding this comment

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

@mcarrano I think, when using a toggle group, the content should reconfigure at the specified breakpoint if expanded content is .pf-m-expanded.

Copy link
Contributor

@mattnolting mattnolting left a comment

Choose a reason for hiding this comment

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

Well done @nicolethoen!!! It's really exciting to see all the great work you've done in action. Left some comments.

Copy link
Collaborator

@mturley mturley left a comment

Choose a reason for hiding this comment

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

Awesome work @nicolethoen !

{toggleIcon}
</Button>
</div>
{ isExpanded ? ReactDOM.createPortal(children, expandableContentRef.current): children }
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm so glad this worked! For a while there I thought there might not be a declarative way to achieve this... but context, refs and portals = magic ✨

@nicolethoen nicolethoen changed the title [WIP] feat(DataToolbar): Add Data Toolbar component to experimental feat(DataToolbar): Add Data Toolbar component to experimental Sep 9, 2019
mturley
mturley previously approved these changes Sep 10, 2019
Copy link
Collaborator

@mturley mturley left a comment

Choose a reason for hiding this comment

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

Noticed a few non-blocking things, but this looks good to me.

</Select>
</DataToolbarItem>
<DataToolbarItem>
<Select
Copy link
Collaborator

Choose a reason for hiding this comment

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

There's some inconsistent indentation/spacing here and elsewhere in this file, but I don't think we need to hold up the PR for it. I'll address cases like this when I rebase #2810 after the release, but I'm not sure if Prettier will run on the JSX in our Markdown files, so that's something else I want to look into.

variant="plain"
onClick={toggleIsExpanded}
{...isExpanded && { 'aria-expanded': true }}
// TODO aria-haspopup when isExpanded = true && viewport is smaller than lg global breakpoint
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this something we need to implement with this PR, and if not can we open an issue to track it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good thought

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's open an issue for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Issue created

Copy link
Contributor

@mattnolting mattnolting left a comment

Choose a reason for hiding this comment

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

@nicolethoen Again, great work! Can we add an example of .pf-m-space-items on a group to the Data toolbar spacers example? Perhaps the last two action buttons?

@nicolethoen can we add a horizontal divider to the Data toolbar group stacked example?

@mcarrano @mceledonia should we add a horizontal divider to the Data toolbar group stacked example?

@nicolethoen
Copy link
Contributor Author

@nicolethoen Again, great work! Can we add an example of .pf-m-space-items on a group to the Data toolbar spacers example? Perhaps the last two action buttons?

@nicolethoen can we add a horizontal divider to the Data toolbar group stacked example?

Yes and Yes!

@mcarrano
Copy link
Member

@nicolethoen This is looking great. Agree with adding the horizontal divider to the stacked example. The only other thing I found is that for the Consumer managed toggle group example, I can get into a situation where the drawer remains open but the toggle disappears by opening the drawer and then stretching the window. See below.

Screen Shot 2019-09-10 at 11 24 30 AM

If this is not easy to fix. I'd be OK to approve this and come back to address this as a bug in the next release.

@karelhala
Copy link
Contributor

@mcarrano that's exactly what is discussed in #2861 (comment)

Consumers should be rensponsible when the pane is hidden and shown in this example. So if you open this toggle change the screen size and want to close the pane consumer is responsible for that. It's actually expected bahavior.

@nicolethoen
Copy link
Contributor Author

@nicolethoen This is looking great. Agree with adding the horizontal divider to the stacked example. The only other thing I found is that for the Consumer managed toggle group example, I can get into a situation where the drawer remains open but the toggle disappears by opening the drawer and then stretching the window. See below.

Screen Shot 2019-09-10 at 11 24 30 AM

If this is not easy to fix. I'd be OK to approve this and come back to address this as a bug in the next release.

I noted this issue in the documentation above the example.

Copy link
Contributor

@dlabaj dlabaj left a comment

Choose a reason for hiding this comment

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

A few comments but looks good otherwise.

className?: string;
/** Content to be rendered as rows in the Data toolbar */
children?: React.ReactNode;
/** Flag indicating if a Data toolbar toggle group's expandable content is expanded */
Copy link
Contributor

Choose a reason for hiding this comment

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

We should add a comment that setting this means that the consumer will be responsible for managing the toogle group expansion. Also how would a consumer find out if the toogle group is currently expanded after construction??? Can we use a getter to return the correct value.

Copy link
Collaborator

Choose a reason for hiding this comment

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

If the consumer is managing the expansion, they would already know, right? If the consumer is not managing the expansion, why do they need to be able to find out if it's currently expanded?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is some documentation just before the toggle group examples that i believe explains this? should I add more info to that documentation?

variant="plain"
onClick={toggleIsExpanded}
{...isExpanded && { 'aria-expanded': true }}
// TODO aria-haspopup when isExpanded = true && viewport is smaller than lg global breakpoint
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's open an issue for this.

dlabaj
dlabaj previously approved these changes Sep 10, 2019
mcarrano
mcarrano previously approved these changes Sep 10, 2019
Copy link
Member

@mcarrano mcarrano left a comment

Choose a reason for hiding this comment

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

Looks great @nicolethoen !

Copy link
Contributor

@mattnolting mattnolting left a comment

Choose a reason for hiding this comment

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

Just two more comments 😄

<DataToolbarItem spacers={fifthSpacers}><Button variant="secondary">Action</Button></DataToolbarItem>
<DataToolbarItem><Button variant="primary">Action</Button></DataToolbarItem>
<DataToolbarItem variant="separator"></DataToolbarItem>
<DataToolbarGroup itemSpacers={[{spacerSize: 'lg'}]} spacers={[{spacerSize: 'lg'}]}>
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you remove spacers={[{spacerSize: 'lg'}]}

<DataToolbarItem variant="separator"></DataToolbarItem>
<DataToolbarGroup itemSpacers={[{spacerSize: 'lg'}]} spacers={[{spacerSize: 'lg'}]}>
<DataToolbarItem><Button variant="secondary">Action</Button></DataToolbarItem>
` <DataToolbarItem><Button variant="secondary">Action</Button></DataToolbarItem>
Copy link
Contributor

Choose a reason for hiding this comment

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

looks like you have a floating tick mark ^^

@nicolethoen nicolethoen dismissed stale reviews from mcarrano and dlabaj via abe78d6 September 10, 2019 18:54
Copy link
Contributor

@mattnolting mattnolting left a comment

Choose a reason for hiding this comment

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

I love it!! 🎉 LGTM

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

Copy link
Collaborator

@mturley mturley left a comment

Choose a reason for hiding this comment

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

LGTM!

@dlabaj dlabaj merged commit 6ec0ce4 into patternfly:master Sep 10, 2019
@patternfly-build
Copy link
Collaborator

Your changes have been released in:

  • @patternfly/react-core@3.104.0
  • @patternfly/react-docs@4.13.0
  • @patternfly/react-inline-edit-extension@2.11.35
  • demo-app-ts@2.24.8
  • @patternfly/react-table@2.20.15
  • @patternfly/react-topology@2.8.34
  • @patternfly/react-virtualized-extension@1.2.23

Thanks for your contribution! 🎉

@nicolethoen nicolethoen deleted the toolbar_component branch February 8, 2023 13:46
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.

8 participants