-
Notifications
You must be signed in to change notification settings - Fork 0
Global Nav #124
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
Global Nav #124
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
e099b50
new global nav
colegoldsmith d37dcd0
remove package
colegoldsmith 0ad6432
Merge branch 'main' of github.com:riptano/docs-ui into unified-nav
colegoldsmith 7d6f8aa
Add unified draft trigger workflow
mlr 69839fb
Add branch to unified draft trigger push arguments
mlr 1c9da2f
scrolling nav buttons
colegoldsmith dfe08c5
Merge branch 'unified-nav' of github.com:riptano/docs-ui into unified…
colegoldsmith 9167bc7
highlight active menu item
colegoldsmith 84df49e
shift dropdown middleware
colegoldsmith f8626ea
conditionally render global nav styles
colegoldsmith d9bf539
version switcher, component title link, dropdown a11y improvements
colegoldsmith 14e5217
title styles
colegoldsmith 8c54b4e
page version changes
colegoldsmith 01f9925
Merge branch 'main' into unified-nav
mlr 07c6e9f
Undo unintentional changes to draft workflow
mlr 5a2f5d2
design review changes
colegoldsmith a872f89
icon color change
colegoldsmith 2da0f5c
global nav change
colegoldsmith 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
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
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
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
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,15 @@ | ||
@layer components { | ||
.dropdown .dropdown-content { | ||
@apply invisible fixed left-0 top-0 origin-top scale-95 transform opacity-0 motion-safe:transition motion-safe:duration-300 motion-safe:ease-in-out; | ||
|
||
/* Shadow-100 */ | ||
box-shadow: | ||
0px 4px 5px 0px rgba(10, 10, 10, 0.08), | ||
0px 1px 10px 0px rgba(10, 10, 10, 0.08), | ||
0px 2px 4px 0px rgba(32, 41, 58, 0.14); | ||
} | ||
|
||
.dropdown .dropdown-content.active { | ||
@apply visible scale-100 opacity-100; | ||
} | ||
} |
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,32 @@ | ||
.global-nav > .scroll-btn-left, | ||
.global-nav > .scroll-btn-right { | ||
@apply invisible absolute opacity-0 motion-safe:transition-all; | ||
|
||
&.active { | ||
@apply visible opacity-100; | ||
} | ||
} | ||
|
||
.global-nav > .scroll-btn-left { | ||
@apply left-0 rounded-tl py-3 pl-2 pr-4; | ||
} | ||
|
||
.global-nav > .scroll-btn-right { | ||
@apply right-0 rounded-tr py-3 pl-4 pr-2; | ||
} | ||
|
||
html[data-theme="light"] .global-nav > .scroll-btn-left { | ||
background: linear-gradient(to left, rgba(255, 255, 255, 0), rgb(255, 255, 255), rgb(255, 255, 255) 50%); | ||
} | ||
|
||
html[data-theme="dark"] .global-nav > .scroll-btn-left { | ||
background: linear-gradient(to left, rgba(9, 9, 9, 0), rgb(9, 9, 9), rgb(9, 9, 9) 50%); | ||
} | ||
|
||
html[data-theme="light"] .global-nav > .scroll-btn-right { | ||
background: linear-gradient(to right, rgba(255, 255, 255, 0), rgb(255, 255, 255), rgb(255, 255, 255) 50%); | ||
} | ||
|
||
html[data-theme="dark"] .global-nav > .scroll-btn-right { | ||
background: linear-gradient(to right, rgba(9, 9, 9, 0), rgb(9, 9, 9), rgb(9, 9, 9) 50%); | ||
} |
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
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
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
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,28 @@ | ||
'use strict' | ||
|
||
module.exports = module.exports = (navItem, { | ||
data: { | ||
root: { page }, | ||
}, | ||
}) => { | ||
const pageVersion = page.componentVersion?.version | ||
const pageComponent = page.component?.name | ||
|
||
const matchesComponentAndVersion = (item) => { | ||
if (pageVersion) { | ||
return item.component === pageComponent && item.version === pageVersion | ||
} else { | ||
return item.component === pageComponent | ||
} | ||
} | ||
|
||
if (navItem.component) { | ||
return matchesComponentAndVersion(navItem) | ||
} | ||
|
||
if (navItem.items) { | ||
return navItem.items.some(matchesComponentAndVersion) | ||
} | ||
|
||
return false | ||
} |
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,44 @@ | ||
'use strict' | ||
|
||
const mapNavList = (list, contentCatalog) => { | ||
return list.map((item) => { | ||
if (item.xref) { | ||
const page = contentCatalog.resolvePage(item.xref) | ||
if (page) item.url = page.pub.url | ||
if (page?.src?.component) { | ||
item.component = page.src.component | ||
} | ||
if (page?.src?.version) { | ||
item.version = page.src.version | ||
} | ||
item.urlType = 'internal' | ||
delete item.xref | ||
} | ||
if (item.url && item.url.startsWith('http')) item.urlType = 'external' | ||
if (item.items) { | ||
item.items = mapNavList(item.items, contentCatalog) | ||
} | ||
return item | ||
}) | ||
} | ||
|
||
module.exports = ({ | ||
data: { | ||
root: { | ||
contentCatalog = { resolvePage: () => undefined, getComponent: () => undefined }, | ||
site, | ||
}, | ||
}, | ||
}) => { | ||
let globalNav = site?.keys?.globalNav | ||
|
||
if (!globalNav) return [] | ||
if (globalNav._compiled) return globalNav | ||
|
||
globalNav = mapNavList(JSON.parse(globalNav), contentCatalog) | ||
|
||
globalNav._compiled = true | ||
|
||
site.keys.globalNav = globalNav | ||
return globalNav | ||
} |
File renamed without changes.
File renamed without changes.
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.
Most changes to this file are to show the version switcher, copied from the default Antora UI