Conversation
jonrohan
left a comment
There was a problem hiding this comment.
👍 from me.
I went through this PR and changed our stories to use storiesFromMarkdown. I also fixed the function to convert any octicons rails tags to a react component.
…into underline-nav
broccolini
left a comment
There was a problem hiding this comment.
This is looking great! I have some minor feedback on class names and a couple of nested styles, and a bit more feedback on documentation, but the majority of this looks 👌 ✨
Sorry this ended up being so late today, hopefully it won't be too hard to update class names in your github pr but let me know if you need a hang with that.
| border-bottom: 1px solid $gray-200; | ||
| } | ||
|
|
||
| .UnderlineNav-items { |
There was a problem hiding this comment.
I feel a little worried having UnderlineNav-items and UnderlineNav-item will be a bit confusing and not immediately obvious what they do. Could we change UnderlineNav-items to UnderlineNav-body? That's a pattern we use elsewhere and I think it makes sense because you have actions to handle other content. Otherwise best I could think of was UnderlineNav-items-container or wrapper but they get a little long 😬
| text-align: center; | ||
| border-bottom: 2px solid transparent; | ||
|
|
||
| .Counter { |
There was a problem hiding this comment.
I'd prefer to avoid nesting other component selectors like this because it creates dependencies and means overriding if we want to act differently. We could just use the ml-1 utility. How strongly do you feel this needs to be built into the pattern?
There was a problem hiding this comment.
I removed this from the component. My only concern is that people will use inconsistent spacing, but I think it needs to be flexible because markup spacing affects this
There was a problem hiding this comment.
Yeah this, and the other similar scenarios, are tricky. This is where I feel like we should handle the Counter styling in context with the UnderlineNav in other parts of the code (say helpers or something), rather than Sass. Handling it in the Sass means adding additional classes to apply to components that may already require a number of classes. That's not the worst but can feel like overkill and be a contributor to CSS bloat. We don't have a good solution for handling elsewhere in the code base right now, but it keeps coming up and is something that's on our radar. If we start to see this particular use case being styled incorrectly, then the best option is to have another class to apply to the Counter rather than nesting it.
| margin-left: $spacer-1; | ||
| } | ||
|
|
||
| .octicon { |
There was a problem hiding this comment.
Similar thoughts here to nesting Counter. We could have an element class to account for it, such as UnderlineNav-octicon as utilities won't work because you need the hover styles.
There was a problem hiding this comment.
I removed the spacing from the component (same concern as Counter) but kept the color styles in under .UnderlineNav-octicon
|
|
||
| .container-lg, | ||
| .container-md, | ||
| .container-xl { |
There was a problem hiding this comment.
Same here re nesting other Primer styles. UnderlineNav-container may work? It's a little bit of a quirky one and potentially could be done with utilities but I can image this tripping people up so probably good to offer it as part of the component styles.
There was a problem hiding this comment.
Changed this to .UnderlineNav-container 👍
modules/primer-navigation/README.md
Outdated
|
|
||
| ## Underline nav | ||
|
|
||
| `.UnderlineNav` is navigation that is typically used at the top of a page as the main page navigation. |
There was a problem hiding this comment.
This could be worded better, it says navigation twice and descriptions could be a little more helpful. Suggest something like this but feel free to edit:
Use
UnderlineNavto style navigation with a minimal underlined selected state. This component comes with variations to accommodate icons, counters, and button actions; and is typically used for navigation placed at the top of the page.
modules/primer-navigation/README.md
Outdated
| </nav> | ||
| ``` | ||
|
|
||
| Use `.UnderlineNav-actions` to use another element alongside the underline nav |
There was a problem hiding this comment.
Use is used twice here, could be worded better, suggest something like this:
Use
.UnderlineNav-actionsto place another element, such as a button, to the opposite side of the navigation items.
modules/primer-navigation/README.md
Outdated
| </nav> | ||
| ``` | ||
|
|
||
| You can right align the navigation with `.UnderlineNav--right`. |
There was a problem hiding this comment.
To keep in style with our newer docs (i.e. less wordy and command tense), suggest changing this to:
Use
.UnderlineNav--rightto right align the navigation.
modules/primer-navigation/README.md
Outdated
| </nav> | ||
| ``` | ||
|
|
||
| This also works when adding actions. |
There was a problem hiding this comment.
Suggest changing description to: UnderlineNav--right also works with when used with UnderlineNav-actions.
modules/primer-navigation/README.md
Outdated
| ``` | ||
|
|
||
|
|
||
| The navigation will work with added counters and/or octicons |
There was a problem hiding this comment.
Again, use a more commanding tone, such as:
Countersandocticonscan be used with navigation items:
modules/primer-navigation/README.md
Outdated
| </nav> | ||
| ``` | ||
|
|
||
| Use `.UnderlineNav--full` to use a container within the components |
There was a problem hiding this comment.
Suggesting change wording to something like:
Use
UnderlineNav--fullin combination with container styles to make navigation fill the width of the container.
I couldn't find a way to avoid using "container" twice but I think it's okay.
|
@broccolini this is ready for review again! ✨ |
modules/primer-navigation/README.md
Outdated
|
|
||
| ## Underline nav | ||
|
|
||
| Use `.UnderlineNav` to style navigation with a minimal underlined selected state. This component comes with variations to accommodate icons, counters, and button actions; and is typically used for navigation placed at the top of the page. |
There was a problem hiding this comment.
I just realized we need to remove that it accommodates counters becaase of the Sass changes 😬
There was a problem hiding this comment.
I changed it to:
Use
.UnderlineNavto style navigation with a minimal underlined selected state, typically used for navigation placed at the top of the page. This component comes with variations to accommodate icons, containers, and other content.
It's a little wordy, so let me know if you have suggestions!
| text-align: center; | ||
| border-bottom: 2px solid transparent; | ||
|
|
||
| .Counter { |
There was a problem hiding this comment.
Yeah this, and the other similar scenarios, are tricky. This is where I feel like we should handle the Counter styling in context with the UnderlineNav in other parts of the code (say helpers or something), rather than Sass. Handling it in the Sass means adding additional classes to apply to components that may already require a number of classes. That's not the worst but can feel like overkill and be a contributor to CSS bloat. We don't have a good solution for handling elsewhere in the code base right now, but it keeps coming up and is something that's on our radar. If we start to see this particular use case being styled incorrectly, then the best option is to have another class to apply to the Counter rather than nesting it.
broccolini
left a comment
There was a problem hiding this comment.
This looks great! Thank you so much for working on this! 💖 I just have one small comment, otherwise this looks good to merge ![]()
This refactors the underline nav component and and adds documentation to the Navigation component. As discussed here, this:
/cc @primer/ds-core