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

UnderlineNav with updated design for states and counter #2277

Merged
merged 18 commits into from
Sep 5, 2022

Conversation

broccolinisoup
Copy link
Member

@broccolinisoup broccolinisoup commented Aug 26, 2022

Closes #1240

UnderlineNav has updated design and this PR is for the updated states (default, selected, hover and focus state) as well as adding counter as a prop.

Screenshots

Screen Shot 2022-09-01 at 3 13 03 pm

Screen Shot 2022-09-01 at 3 12 32 pm

Screen Recording

UnderlineNav.focus._.hover._.selected.states.mp4

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge

Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.

@changeset-bot
Copy link

changeset-bot bot commented Aug 26, 2022

🦋 Changeset detected

Latest commit: 0699ae0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Aug 26, 2022

size-limit report 📦

Path Size
dist/browser.esm.js 76.29 KB (0%)
dist/browser.umd.js 76.9 KB (0%)

@broccolinisoup broccolinisoup temporarily deployed to github-pages August 26, 2022 09:26 Inactive
@broccolinisoup broccolinisoup changed the title UnderlineNav with updated design for states and counter [WIP]: UnderlineNav with updated design for states and counter Aug 26, 2022
@broccolinisoup broccolinisoup temporarily deployed to github-pages August 26, 2022 12:11 Inactive
@broccolinisoup broccolinisoup temporarily deployed to github-pages August 29, 2022 02:12 Inactive
@broccolinisoup broccolinisoup temporarily deployed to github-pages August 29, 2022 04:58 Inactive
@broccolinisoup broccolinisoup temporarily deployed to github-pages August 29, 2022 05:10 Inactive
@broccolinisoup broccolinisoup temporarily deployed to github-pages August 29, 2022 05:22 Inactive
@broccolinisoup broccolinisoup temporarily deployed to github-pages August 29, 2022 05:52 Inactive

const UnderlineNav = Object.assign(Nav, {
Link: UnderlineNavLink
Item: UnderlineNavItem
Copy link
Collaborator

Choose a reason for hiding this comment

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

This would be a breaking change wrt to the old UnderlineNav. We will need to mention it in the changelog.

Copy link
Collaborator

@pksjce pksjce left a comment

Choose a reason for hiding this comment

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

The focus rings work so well! 💯

I can see two things out of place.

  1. The underline from the nav seems to have gone away.
  2. The selected underline seems a bit longer on both sides compared to the Item.

image

Also I'm sceptical about the name change from UnderlineNav.Link to UnderlineNav.Item. It would break existing API. Though, I agree its a change that makes full sense. Not sure how to proceed with it honestly.

@broccolinisoup broccolinisoup temporarily deployed to github-pages August 30, 2022 05:50 Inactive
@broccolinisoup
Copy link
Member Author

Thanks for the review @pksjce !

The underline from the nav seems to have gone away.

I used the states reference from Figma and there is no underline there so I though this line must have been removed with the updated design but for all the other references in Figma, the line is there! I added it back ✨ Sorry for the confusion!

The selected underline seems a bit longer on both sides compared to the Item.

Yes, you are right! I might have missed that. I also realised there was way too much margin between the li items. So all together, I re-styled them and this is for the reference to compare before and after. (I updated the PR description as well with the new screenshots)

Before

Screen Shot 2022-08-29 at 3 04 21 pm

After
Screen Shot 2022-08-30 at 4 11 22 pm

And the design

Screen Shot 2022-08-30 at 4 14 24 pm

Also I'm sceptical about the name change from UnderlineNav.Link to UnderlineNav.Item. It would break existing API. Though, I agree its a change that makes full sense. Not sure how to proceed with it honestly.

Yeah I agree. It makes sense to me too and I see other "new" components such as ActionList uses Item too so it is good to be consistent. I guess we can discuss with others as well and find the best strategy to move forward with the major release.

@danielguillan
Copy link
Contributor

danielguillan commented Sep 1, 2022

Sorry for the confusion about the removal of the underline.

I initially intentionally removed it so that with the removal of actions, consumers could still easily build a custom UnderlineNav + actions horizontal layout and only deal with the bottom border on the parent container. I also did so to support the use case in the code clone dropdown where we don't use a border at all.

But now that we have a clearer idea of what needs to be supported (and not) and how we'll move forward in the mid-long term, we should bring the underline back.

@danielguillan
Copy link
Contributor

danielguillan commented Sep 1, 2022

I think the name change from UnderlineNav.Link to UnderlineNav.Item makes sense. Please feel free to point anyone interested in this discussion to the design API proposal: https://github.com/github/primer/pull/1239

@broccolinisoup broccolinisoup marked this pull request as ready for review September 1, 2022 11:34
@broccolinisoup broccolinisoup requested a review from a team September 1, 2022 11:34
@broccolinisoup broccolinisoup force-pushed the broccolinisoup/UnderlineNav-states branch from d87eb23 to fcf6cf5 Compare September 4, 2022 23:45
@broccolinisoup broccolinisoup temporarily deployed to github-pages September 4, 2022 23:51 Inactive
@broccolinisoup broccolinisoup temporarily deployed to github-pages September 5, 2022 00:26 Inactive
<Box as="ul" sx={merge<BetterSystemStyleObject>(overflowStyles, ulStyles)}>
{responsiveProps.items}
</Box>

{actions.length > 0 && (
<ActionMenu>
<ActionMenu.Button>More</ActionMenu.Button>
<ActionMenu.Button sx={{m: 0}}>More</ActionMenu.Button>
Copy link
Member Author

Choose a reason for hiding this comment

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

to fix extra margin around the button on safari

Copy link
Collaborator

Choose a reason for hiding this comment

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

wow, can you add a comment here about this?

@broccolinisoup broccolinisoup temporarily deployed to github-pages September 5, 2022 01:05 Inactive
/**
* Counter
*/
counter?: number
Copy link
Collaborator

Choose a reason for hiding this comment

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

@danielguillan - Wondering if we are going to support loading state for counters.

Copy link
Member Author

Choose a reason for hiding this comment

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

Just making a comment here for the types. I added the counter prop with only number type just to make the Counter component redundant. We can add another type for the loading state if we are going to support 😊

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, we are going to support loading states. We can add support incrementally in another PR if that makes things easier.

@broccolinisoup broccolinisoup temporarily deployed to github-pages September 5, 2022 05:01 Inactive
@broccolinisoup broccolinisoup temporarily deployed to github-pages September 5, 2022 05:14 Inactive
@@ -0,0 +1,5 @@
---
'@primer/react': major
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think this should be a major change yet. We'll kind of block ourselves doing that. Once we make all the changes, we can graduate from drafts to main folder with a major change. Could you do that before merging?

@broccolinisoup broccolinisoup temporarily deployed to github-pages September 5, 2022 07:44 Inactive
@broccolinisoup broccolinisoup merged commit cc88235 into main Sep 5, 2022
@broccolinisoup broccolinisoup deleted the broccolinisoup/UnderlineNav-states branch September 5, 2022 08:34
@primer-css primer-css mentioned this pull request Sep 5, 2022
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.

3 participants