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

Update nav styles to match core designs #24987

Merged
merged 6 commits into from
Sep 3, 2020

Conversation

joshuatf
Copy link
Contributor

@joshuatf joshuatf commented Sep 1, 2020

Description

Related to https://github.com/woocommerce/navigation/pull/68 - this PR updates to the latest design exploration for the nav component ( https://www.figma.com/file/e4tLacmlPuZV47l7901FEs/WordPress-Design-Library?node-id=1456%3A72 ).

Screenshots

Screen Shot 2020-09-02 at 10 09 59 AM

@ZebulanStanphill ZebulanStanphill added Needs Accessibility Feedback Need input from accessibility [Feature] Navigation Component A navigational waterfall component for hierarchy of items. labels Sep 1, 2020
@psealock
Copy link
Contributor

psealock commented Sep 2, 2020

I think it makes sense to go with the dark theme and write CSS to the spec pasted above. The reason is because both the FSE and WooCommerce usage won't be in the context of the wp-admin sidebar. Should a time come to examine that change, it will likely be in conjunction with a change to the top nav bar.

FSE and WooCommerce will occupy full screens. This means that this Navigation component won't need to match a background theme color found in wp-admin sidebar or top nav bar.

templates

Screen Shot 2020-09-02 at 12 28 06 PM

I do think that focus style colors should respect the theme. But ping @jameskoster to confirm.

Screen Shot 2020-09-02 at 12 31 43 PM

@jameskoster
Copy link
Contributor

I do think that focus style colors should respect the theme.

Agreed!

@joshuatf
Copy link
Contributor Author

joshuatf commented Sep 2, 2020

Thanks for the input @jameskoster and @psealock! This has been rebased and ready for another review.

Dark styles are added and currently this just respects the built-in theme colors of the GB buttons. If there are more theming issues, I suggest we handle in a follow-up.

This PR also adds menu titles (section titles) and a secondary menu to the nav story to illustrate potential use cases.

@joshuatf joshuatf changed the title WIP: Update nav styles to match core designs Update nav styles to match core designs Sep 2, 2020
Copy link
Contributor

@psealock psealock left a comment

Choose a reason for hiding this comment

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

This is looking really nice @joshuatf. I just left a minor comment.

This PR also adds menu titles (section titles) and a secondary menu to the nav story to illustrate potential use cases.

This is the pattern we set for WooCommerce, but I think its not one we should settle on because it falls short in several ways:

  • The consuming app needs to have knowledge of any secondary menus in its render function as well as at the point of constructing data.
  • This works well for a single secondary menu on the navigation root. What if there is more than one? What if those secondary menu titles need to be dynamic?

I don't think rendering these secondary menus or groupings should be completely the responsibility of the consumer. I created an issue to track that feature in #24992 and I think it'd be best to explore that outside of this PR (even if we do go this route in the end).

@@ -73,13 +73,14 @@ const Navigation = ( { activeItemId, children, data, rootTitle } ) => {
}

return (
<Button
<BackButtonUi
Copy link
Contributor

Choose a reason for hiding this comment

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

Other names have a capitalized I as in BackButtonUI.

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 catch.

@joshuatf
Copy link
Contributor Author

joshuatf commented Sep 3, 2020

Thanks for the review @psealock. Updated the ui component name based on your feedback.

This works well for a single secondary menu on the navigation root. What if there is more than one? What if those secondary menu titles need to be dynamic?

The consumer can decide if there is more than one. In the example, I just added isSecondary but this could be a slug or any other property to discern various menus. The title can also be dynamic here- also up to the consumer.

I do think this should be more up to the consumer and prefer a slightly more compositional approach, though that does come with some drawbacks. We can discuss in #25035

Copy link
Contributor

@psealock psealock left a comment

Choose a reason for hiding this comment

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

Although the example submenu is likely to be removed, the other changes are good to go. Nice job @joshuatf !

.map( ( item ) =>
renderMenuItem( item )
) }
</NavigationMenu>
Copy link
Contributor

Choose a reason for hiding this comment

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

The consumer can decide if there is more than one. In the example, I just added isSecondary but this could be a slug or any other property to discern various menus. The title can also be dynamic here- also up to the consumer.

This is true, and this block is a nice example of the consumer having control. What if the entire navigation has 10 of these submenus throughout the hierarchy? Looking at the designs for FSE, its possible that may be the case. You'd need a block like this for every single submenu. level.children is getting filtered with each block. I think a better way exists and worth exploring.

@psealock psealock merged commit 5991899 into WordPress:feature/navigation Sep 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Navigation Component A navigational waterfall component for hierarchy of items. Needs Accessibility Feedback Need input from accessibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants