-
Notifications
You must be signed in to change notification settings - Fork 401
Minor Nav Refactor + Fix for Overlapping Dropdown Menus #1160
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
d0155b5
refactor: split apart existing Nav UI into smaller, more manageable p…
bolt-bot 409bef3
fix: only allow one top level nav item to be open at a time while ren…
bolt-bot 6da41a1
fix: re-try Netlify preview to debug local vs prod rendering differences
bolt-bot 7a8b418
fix: make sure the top-level Dropdown menus always open/close
bolt-bot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
packages/uikit-workshop/src/scripts/components/pl-nav/src/NavButton.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import { h } from 'preact'; | ||
|
|
||
| export const NavButton = props => { | ||
| return ( | ||
| <button | ||
| className={`pl-c-nav__link pl-c-nav__link--dropdown pl-js-acc-handle`} | ||
| role="tab" | ||
| {...props} | ||
| > | ||
| <span className={`pl-c-nav__link-text`}>{props.children}</span> | ||
| <span | ||
| class="pl-c-nav__link-icon" | ||
| dangerouslySetInnerHTML={{ | ||
| __html: '<pl-icon name="arrow-down"></pl-icon>', | ||
| }} | ||
| /> | ||
| </button> | ||
| ); | ||
| }; |
8 changes: 8 additions & 0 deletions
8
packages/uikit-workshop/src/scripts/components/pl-nav/src/NavItem.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import { h } from 'preact'; | ||
| import cx from 'classnames'; | ||
|
|
||
| export const NavItem = props => { | ||
| const classes = cx('pl-c-nav__item', props.className); | ||
|
|
||
| return <li className={classes}>{props.children}</li>; | ||
| }; |
26 changes: 26 additions & 0 deletions
26
packages/uikit-workshop/src/scripts/components/pl-nav/src/NavLink.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import { h } from 'preact'; | ||
| import { PatternState } from './PatternState'; | ||
|
|
||
| export const NavLink = props => { | ||
| return ( | ||
| <a | ||
| href={`patterns/${props.item.patternPath}`} | ||
| className={`pl-c-nav__link pl-c-nav__link--sublink | ||
| ${ | ||
| props.item.patternName === 'View All' | ||
| ? 'pl-c-nav__link--overview' | ||
| : 'pl-c-nav__link--subsublink' | ||
| } | ||
| `} | ||
| onClick={e => props.elem.handleClick(e, props.item.patternPartial)} | ||
| data-patternpartial={props.item.patternPartial} | ||
| > | ||
| {props.item.patternName === 'View All' && props.category | ||
| ? `${props.category}` | ||
| : props.item.patternName} | ||
| {props.item.patternState && ( | ||
| <PatternState variant={props.item.patternState} /> | ||
| )} | ||
| </a> | ||
| ); | ||
| }; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you walk through all trigger, why you need to remove the
pl-is-activeclass from the next sibling?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This chunk of code was just copied over from what we were already doing in the full Nav cleanup method.
Keep in mind that despite changing how the Nav was previously being rendered, much of the current code here hasn't been fully refactored (hence there's still some cruft to clean up like what you're pointing out here).