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

Refactor underline nav #377

Merged
merged 19 commits into from
Nov 7, 2017
Merged

Refactor underline nav #377

merged 19 commits into from
Nov 7, 2017

Conversation

ampinsk
Copy link
Contributor

@ampinsk ampinsk commented Oct 23, 2017

This refactors the underline nav component and and adds documentation to the Navigation component. As discussed here, this:

  • keeps orange 2px underline, makes selected state bold
  • introduces hover state
  • reduces horizontal padding
  • refactors Sass to work in all contexts (profiles, search, and up-coming teams update)
  • brings class names in alignment with component naming convention
  • moves into Primer and adds documentation

/cc @primer/ds-core

@broccolini broccolini mentioned this pull request Oct 25, 2017
28 tasks
@broccolini broccolini added the v10 label Oct 25, 2017
@jonrohan jonrohan changed the base branch from dev to release-10.0.0 October 27, 2017 19:24
Copy link
Member

@jonrohan jonrohan left a comment

Choose a reason for hiding this comment

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

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

@broccolini
Copy link
Member

@ampinsk We need to test this in github/github before shipping. @jonrohan did you two go through that process yet? If so let's get on that today so that we can include this in v10.

@jonrohan jonrohan changed the base branch from release-10.0.0 to dev November 2, 2017 15:03
@jonrohan jonrohan changed the base branch from dev to release-10.0.0 November 2, 2017 15:14
Copy link
Member

@broccolini broccolini 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 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 {
Copy link
Member

Choose a reason for hiding this comment

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

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 😬

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changing to UnderlineNav-body 👍

text-align: center;
border-bottom: 2px solid transparent;

.Counter {
Copy link
Member

Choose a reason for hiding this comment

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

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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

Copy link
Member

Choose a reason for hiding this comment

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

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 {
Copy link
Member

Choose a reason for hiding this comment

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

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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 {
Copy link
Member

@broccolini broccolini Nov 4, 2017

Choose a reason for hiding this comment

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

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed this to .UnderlineNav-container 👍

@@ -93,12 +93,123 @@ You can also add optional headings to a menu. Feel free to use nearly any semant
</nav>
```

## Underline nav

`.UnderlineNav` is navigation that is typically used at the top of a page as the main page navigation.
Copy link
Member

Choose a reason for hiding this comment

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

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

</nav>
```

Use `.UnderlineNav-actions` to use another element alongside the underline nav
Copy link
Member

Choose a reason for hiding this comment

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

Use is used twice here, could be worded better, suggest something like this:

Use .UnderlineNav-actions to place another element, such as a button, to the opposite side of the navigation items.

</nav>
```

You can right align the navigation with `.UnderlineNav--right`.
Copy link
Member

Choose a reason for hiding this comment

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

To keep in style with our newer docs (i.e. less wordy and command tense), suggest changing this to:

Use .UnderlineNav--right to right align the navigation.

</nav>
```

This also works when adding actions.
Copy link
Member

Choose a reason for hiding this comment

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

Suggest changing description to: UnderlineNav--right also works with when used with UnderlineNav-actions.

```


The navigation will work with added counters and/or octicons
Copy link
Member

Choose a reason for hiding this comment

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

Again, use a more commanding tone, such as:

Counters and octicons can be used with navigation items:

</nav>
```

Use `.UnderlineNav--full` to use a container within the components
Copy link
Member

Choose a reason for hiding this comment

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

Suggesting change wording to something like:

Use UnderlineNav--full in 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.

@ampinsk
Copy link
Contributor Author

ampinsk commented Nov 6, 2017

@broccolini this is ready for review again! ✨

@@ -93,12 +93,118 @@ You can also add optional headings to a menu. Feel free to use nearly any semant
</nav>
```

## 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.
Copy link
Member

Choose a reason for hiding this comment

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

I just realized we need to remove that it accommodates counters becaase of the Sass changes 😬

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed it to:

Use .UnderlineNav to 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 {
Copy link
Member

Choose a reason for hiding this comment

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

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.

Copy link
Member

@broccolini broccolini left a comment

Choose a reason for hiding this comment

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

This looks great! Thank you so much for working on this! 💖 I just have one small comment, otherwise this looks good to merge :shipit:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants