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

Polish side navigation styling #155

Merged
merged 7 commits into from
Jun 16, 2020
Merged

Polish side navigation styling #155

merged 7 commits into from
Jun 16, 2020

Conversation

caylahamann
Copy link
Contributor

@caylahamann caylahamann commented Jun 16, 2020

Description

  • Sidebar links updated into sidenav.json
  • Navigation will collapse based on page you are currently on (breadcrumbs)
  • Attempting to do styling specified in designs for recursively defined navigation

Reviewer Notes

This is a WIP but I just wanted to open a PR in case anybody had a free moment to look at it or give feedback. I'm planning on changing the nested sass once I refactor the recursive function (I'm going to keep track of levels and dynamically add classes that way) and also styling according to the designs

Related Issue(s) / Ticket(s)

If there are any related GitHub Issues or JIRA tickets, add links to them here.

Screenshot(s)

Screen Shot 2020-06-16 at 5 07 02 PM

Screen Shot 2020-06-16 at 5 06 53 PM

Screen Shot 2020-06-16 at 5 06 44 PM

@caylahamann caylahamann added the work in progress This is work that is not yet ready for review label Jun 16, 2020
@jerelmiller
Copy link
Contributor

A couple things to note looking at the PR preview:

  • When on the homepage, all the sections should be expanded. Currently they are collapsed.
  • The headings of each section will be links themselves to overview pages for that section. I see right that these headings act as an expand/collapse toggle
  • Let's remove the underline on hover for each sidebar link

@caylahamann
Copy link
Contributor Author

caylahamann commented Jun 16, 2020

A couple things to note looking at the PR preview:

  • When on the homepage, all the sections should be expanded. Currently they are collapsed.
  • The headings of each section will be links themselves to overview pages for that section. I see right that these headings act as an expand/collapse toggle
  • Let's remove the underline on hover for each sidebar link

Removed the underline, the homepage is now expanded, and made the headings of each sections as links (except for the developer section)

display: none;
}

.isDisplay {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be better to call this class name expanded? It took me a bit to realize the isDisplay was for expanding a section of the nav.

@@ -0,0 +1,3 @@
import React from 'react';

export const BreadcrumbContext = React.createContext([]);
Copy link
Contributor

Choose a reason for hiding this comment

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

[nit] You can make this the default export since this is the "main" thing exported from this file.

);
<div
role="button"
onClick={() => setIsDisplay(!isDisplay)}
Copy link
Contributor

Choose a reason for hiding this comment

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

Out of curiosity, if you do have a section that is collapsed and can be expanded because it doesn't include a url, will this collapse other sections or leave them open?


const Sidebar = ({ className, pages, isOpen, toggle }) => (
if (page.children) {
subNav = renderNav(page.children, depthLevel + 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

[nit] Since this subnav variable isn't used elsewhere, you can move this inline:

<ul {/* ... */}>
  {page.children && renderNav(page.children, depthLevel + 1)}
<ul>

Totally your call on what you find more readable.

key={index}
>
{display}
<ul className={cx(styles.nestedNav, { [styles.isDisplay]: isDisplay })}>
Copy link
Contributor

Choose a reason for hiding this comment

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

If there are no children for the page, does this ul render with empty content? Should this ul render at all if there are no links to render inside of it?

className={cx(styles[`navDepth${depthLevel}`], {
[styles.isCurrentPage]: isCurrentPage,
})}
key={index}
Copy link
Contributor

Choose a reason for hiding this comment

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

Since the URLs should all be unique, I think it would be better to use that url as the key here. This will be more efficient for React since it won't need to destroy/recreate the DOM nodes if the links re-order themselves (like if a section is collapsed, or we add filtering to the nav).

font-weight: bold;
text-transform: uppercase;
color: var(--color-neutrals-600);
font-size: 14px;
Copy link
Contributor

Choose a reason for hiding this comment

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

[style] Prefer rems instead of px for font sizes. Can you change this to 0.875rem?

Copy link
Contributor

Choose a reason for hiding this comment

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

I see that the .sidebar class already includes this font size. Is there a need for this declaration here?

@jerelmiller
Copy link
Contributor

Will merge this PR and address some of these things in a future PR that addresses more general layout polish.

@jerelmiller jerelmiller merged commit 009e72f into master Jun 16, 2020
@jerelmiller jerelmiller deleted the cayla/side-nav-styling branch June 16, 2020 22:32
@nr-opensource-bot
Copy link
Contributor

🎉 This PR is included in version 1.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released work in progress This is work that is not yet ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants