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

docs(Page): Update examples and demos to use Masthead #6388

Merged

Conversation

wise-king-sullyman
Copy link
Contributor

What: Closes #6281

Additional issues: N/A

Refactors the Page examples to use Masthead and Toolbar rather than PageHeader and PageHeaderTools. One Page example using PageHeader was kept but relocated to be the last example.

A new Page demo was added using Masthead, the other demos were renamed to clarify that they're using PageHeader.

@patternfly-build
Copy link
Contributor

patternfly-build commented Oct 1, 2021

PF4 preview: https://patternfly-react-pr-6388.surge.sh

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.

@wise-king-sullyman So is it only the first demo then that was refactored to use the new masthead? In any case, the masthead utility items should be updated to match the updated Navigation demos. Here's what that should look like:

Screen Shot 2021-10-01 at 9 05 43 AM

And also see this: https://patternfly-react-pr-6388.surge.sh/components/navigation/react-demos/default-nav/

@wise-king-sullyman
Copy link
Contributor Author

wise-king-sullyman commented Oct 1, 2021

@mcarrano Yes only the first demo was refactored to use Masthead, the others I left to demonstrate PageHeader since it's still in use. If you would like me to get rid of/refactor all of the PageHeader demos (or two of the three) though I'm happy to do so.

I will update the utility items shortly 👍

@mcarrano
Copy link
Member

mcarrano commented Oct 1, 2021

@wise-king-sullyman I think it's OK to leave the other demos as is and just update the first one with the new utility items.

@wise-king-sullyman
Copy link
Contributor Author

While doing requested updates I also updated demo screenshots and removed unneeded toolbar groups from the page examples to make them cleaner.

Copy link
Contributor

@nicolethoen nicolethoen left a comment

Choose a reason for hiding this comment

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

Could you add href="#" to each of the navItems in the demos - so that when the user tabs through the page, it will grant access to the tertiary nav items?

Copy link
Contributor

@redallen redallen left a comment

Choose a reason for hiding this comment

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

Thanks for updating the demo thumbnails! I'm a bit confused about what we're doing with the old PageHeader now.

mcarrano
mcarrano previously approved these changes Oct 1, 2021
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. Thanks for making those changes.

@evwilkin
Copy link
Member

evwilkin commented Oct 2, 2021

(FYI deleted my comment, not able to reproduce issue anymore that only I was seeing.)

redallen
redallen previously approved these changes Oct 4, 2021
Copy link
Contributor

@redallen redallen left a comment

Choose a reason for hiding this comment

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

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.

Looks great! The only issue I see is icon-button-group grouping.

Comment on lines 196 to 238
<ToolbarGroup
variant="icon-button-group"
alignment={{ default: 'alignRight' }}
spacer={{ default: 'spacerNone', md: 'spacerMd' }}
>
<ToolbarItem>
<Button aria-label="Notifications" variant={ButtonVariant.plain}>
<AttentionBellIcon />
</Button>
</ToolbarItem>
<ToolbarGroup variant="icon-button-group" visibility={{ default: 'hidden', lg: 'visible' }}>
<ToolbarItem>
<Button aria-label="Settings actions" variant={ButtonVariant.plain}>
<CogIcon />
</Button>
</ToolbarItem>
<ToolbarItem>
<Button aria-label="Help actions" variant={ButtonVariant.plain}>
<HelpIcon />
</Button>
</ToolbarItem>
</ToolbarGroup>
</ToolbarGroup>
<ToolbarItem visibility={{ default: 'hidden', md: 'visible', lg: 'hidden' }}>
<Dropdown
isPlain
position="right"
onSelect={this.onKebabDropdownSelect}
toggle={<KebabToggle onToggle={this.onKebabDropdownToggle} />}
isOpen={isKebabDropdownOpen}
dropdownItems={kebabDropdownItems}
/>
</ToolbarItem>
<ToolbarItem visibility={{ default: 'visible', md: 'hidden', lg: 'hidden', xl: 'hidden', '2xl': 'hidden' }}>
<Dropdown
isPlain
position="right"
onSelect={this.onFullKebabSelect}
toggle={<KebabToggle onToggle={this.onFullKebabToggle} />}
isOpen={isFullKebabDropdownOpen}
dropdownItems={fullKebabItems}
/>
</ToolbarItem>
Copy link
Contributor

Choose a reason for hiding this comment

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

All of the dropdowns/icon buttons go in the same base icon-button-group for proper spacing.

<ToolbarGroup
  variant="icon-button-group"
  alignment={{ default: 'alignRight' }}
  spacer={{ default: 'spacerNone', md: 'spacerMd' }}
>
  <ToolbarItem>Bell</ToolbarItem>
  <ToolbarItem>Cog</ToolbarItem>
  <ToolbarItem>Help</ToolbarItem>
  <ToolbarItem>Dropdown</ToolbarItem>
  <ToolbarItem>Dropdown</ToolbarItem>
</ToolbarGroup>

Then place the user dropdown outside of the icon-button-group

<ToolbarItem visibility={{ default: 'hidden', md: 'visible' }}>
  <Dropdown
    position="right"
    onSelect={this.onDropdownSelect}
    isOpen={isDropdownOpen}
    toggle={
      <DropdownToggle icon={<Avatar src={imgAvatar} alt="Avatar" />} onToggle={this.onDropdownToggle}>
        John Smith
      </DropdownToggle>
    }
    dropdownItems={userDropdownItems}
  />
</ToolbarItem>

Copy link
Contributor Author

@wise-king-sullyman wise-king-sullyman Oct 4, 2021

Choose a reason for hiding this comment

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

I actually copied that from DashboardHeader.js want me to go ahead and fix it there too? Or since that's not directly related would it be too out of scope for this refactor?

For now, I'll just fix it here. @mattnolting if you would like this fixed in DashboardHeader under this PR as well just let me know and I'll add it in.

@mattnolting
Copy link
Contributor

I actually copied that from DashboardHeader.js want me to go ahead and fix it there too? Or since that's not directly related would it be too out of scope for this refactor?

@wise-king-sullyman Oh, I see that now. It's a bit off in dashboard header as is. Toolbar groups and items can be nested infinitely, so having an icon-button-group inside of an icon-button-group is perfectly fine, as the purpose is to hide the entire group, rather than individual items within. That's what DashboardHeader.js is doing. But the last, user avatar dropdown should be outside of any icon-button-group resulting in added spacing between the row of icons and user avatar dropdown.

For now, I'll just fix it here. @mattnolting if you would like this fixed in DashboardHeader under this PR as well just let me know and I'll add it in.

You could just fix here and we'll create a followup. Maybe DashboardHeader.js update could highlight its current implementation, with the user avatar dropdown outside, rather than inside, of the icon-button-group as an alternative ;)

Co-authored-by: Matt Nolting <matthew.nolting@gmail.com>
@wise-king-sullyman
Copy link
Contributor Author

Just realized that the three-dot dropdown isn't supposed to show at the same time as the help icon and settings gear, because it contains the help icon and settings gear. Also your comment about the nested group being allowed, and that the purpose is to hide those items together just clicked with me.

I'm thinking the proper course of action moving forward is to add the nested toolbar group back in around the help and gear icons, with the appropriate visibility settings, and just keep the non-user dropdowns in the first tier of ToolbarGroups with the user dropdown outside of any ToolbarGroups.

Is that correct/what you're looking for @mattnolting ? I figure it's worth checking in with you this time before I just assume that I'm understanding you correctly again.

@mattnolting
Copy link
Contributor

@wise-king-sullyman

Just realized that the three-dot dropdown isn't supposed to show at the same time as the help icon and settings gear, because it contains the help icon and settings gear. Also your comment about the nested group being allowed, and that the purpose is to hide those items together just clicked with me.

Awesome! 💯

I'm thinking the proper course of action moving forward is to add the nested toolbar group back in around the help and gear icons, with the appropriate visibility settings, and just keep the non-user dropdowns in the first tier of ToolbarGroups with the user dropdown outside of any ToolbarGroups.

Yep, you got it!

Is that correct/what you're looking for @mattnolting ? I figure it's worth checking in with you this time before I just assume that I'm understanding you correctly again.

Perfect 👍

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.

LPTM! Excellent work @wise-king-sullyman 💎

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 good to me, too. Thanks @wise-king-sullyman !

@redallen redallen merged commit dc0370a into patternfly:main Oct 5, 2021
headerTools={<PageHeaderTools>header-tools</PageHeaderTools>}
topNav="Navigation"
/>
<Masthead display={{ default: 'stack' }} inset={{ default: 'insetXs' }}>
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think the forced stack display is needed here. The horizontal page indicates the navigation is inside the toolbar rather than in a separate sidebar.

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.

Refactor Page examples/demos to use Masthead
8 participants