-
Notifications
You must be signed in to change notification settings - Fork 274
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(nav): Enable override of nav item list via shadowing (#560)
* feat(nav): refactor nav item list to enable shadowing Refactor building of the nav item list to standalone file for override Enables alternate mechanisms for building the nav item list * reorder import line for cleaner diff from upstream * reorder file for cleaner diff with upstream * docs: add documentation to accompany PR #560 shows how to customize the left nav via Gatsby shadowing
- Loading branch information
Showing
3 changed files
with
48 additions
and
20 deletions.
There are no files selected for viewing
This file contains 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 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
24 changes: 24 additions & 0 deletions
24
packages/gatsby-theme-carbon/src/components/LeftNav/LeftNavItemProvider.js
This file contains 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,24 @@ | ||
import { useStaticQuery, graphql } from 'gatsby'; | ||
|
||
export function useNavItems() { | ||
const { | ||
allNavItemsYaml: { edges }, | ||
} = useStaticQuery(graphql` | ||
query LEFT_NAV_QUERY { | ||
allNavItemsYaml { | ||
edges { | ||
node { | ||
title | ||
pages { | ||
title | ||
path | ||
} | ||
} | ||
} | ||
} | ||
} | ||
`); | ||
|
||
const navItems = edges.map(({ node }) => node); | ||
return navItems; | ||
} |
ce6a9b3
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.
Successfully deployed to following URLs: