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

Add navigation back button as separate component #25520

Merged
merged 2 commits into from
Sep 22, 2020

Conversation

joshuatf
Copy link
Contributor

Description

Separates the back button to a separate component so we can reuse styling for back buttons outside the parent/child relationship of menus. Also sneaks in a small styling change to fix margin between menu and buttons.

Used for the "WordPress Dashboard" button in the WooCommerce menu.

How has this been tested?

Tested using storybook examples and in the wc nav repo.

Screenshots

Screen Shot 2020-09-21 at 3 10 45 PM

Testing

  1. Run npm run storybook:dev.
  2. Make sure no regressions have occurred with back buttons.

import { MenuBackButtonUI } from '../styles/navigation-styles';

export default function NavigationMenu( props ) {
const { backButtonLabel, className, href, onClick, parentMenu } = props;
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: since props is not used in the component, we could just destructure it in the function parameter.

export default function NavigationMenu( { backButtonLabel, className, href, onClick, parentMenu } ) {

Copy link
Contributor

@Copons Copons left a comment

Choose a reason for hiding this comment

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

This LGTM!
I've left a nitpick, but it can be merged either way.

@joshuatf
Copy link
Contributor Author

Thanks for the review, @Copons! Applied your feedback and fixed up conflicts.

@joshuatf joshuatf merged commit 4c8dd01 into WordPress:master Sep 22, 2020
@joshuatf joshuatf deleted the add/nav-back-button branch September 22, 2020 16:34
@github-actions github-actions bot added this to the Gutenberg 9.1 milestone Sep 22, 2020
@ZebulanStanphill ZebulanStanphill added [Feature] Navigation Component A navigational waterfall component for hierarchy of items. [Package] Components /packages/components labels Sep 22, 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. [Package] Components /packages/components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants