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 nav badges #24528

Merged
merged 6 commits into from
Aug 18, 2020
Merged

Add nav badges #24528

merged 6 commits into from
Aug 18, 2020

Conversation

joshuatf
Copy link
Contributor

Description

REBASE NEEDED: This PR was branched from #24522 and will need a rebase it's merged.

Adds nav badge property to nav items and adds base styling for the badges.

Note: this currently does not limit the badge to a type of integer. I'm not sure if there are use cases that exist for strings, but we could sanitize in this PR if we decide only number should be allowed.

Screenshots

Screen Shot 2020-08-12 at 6 11 24 PM

Testing

  1. Run npm run storybook:dev in a terminal.
  2. Note the badge in the Navigation story.
  3. Note the child item badge (without a chevron icon) is also styled appropriately.

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.

Cool, looks good. Going from a previous comment, BadgeUI would be better name.

`;

export const Badge = styled.span`
margin-left: 8px;
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems unnecessary

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is needed to keep even spacing between elements if a menu item name is longer. Note the spacing here is uneven:
Screen Shot 2020-08-17 at 4 13 13 PM

Keeping the margin on the badge is a better choice than the text so that elements are preemptively shortened if a badge does not exist.

@psealock psealock added the [Feature] Navigation Component A navigational waterfall component for hierarchy of items. label Aug 17, 2020
@joshuatf
Copy link
Contributor Author

BadgeUI would be better name.

Agreed, @psealock. Updated in e29fd51

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.

Thanks for the changes. This is rebase and ready to merge.

@psealock psealock merged commit 693f137 into WordPress:feature/navigation Aug 18, 2020
psealock added a commit that referenced this pull request Aug 25, 2020
* Migrate styles to css-in-js

* Add spacing to navigation child items

* Add badge property and styles to navigation items

* Update UI component naming

* newLine

Co-authored-by: Paul Sealock <psealock@gmail.com>
psealock added a commit that referenced this pull request Aug 26, 2020
* Migrate styles to css-in-js

* Add spacing to navigation child items

* Add badge property and styles to navigation items

* Update UI component naming

* newLine

Co-authored-by: Paul Sealock <psealock@gmail.com>
psealock added a commit that referenced this pull request Aug 31, 2020
* Migrate styles to css-in-js

* Add spacing to navigation child items

* Add badge property and styles to navigation items

* Update UI component naming

* newLine

Co-authored-by: Paul Sealock <psealock@gmail.com>
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants