-
Notifications
You must be signed in to change notification settings - Fork 52
feat(ui): add navbar and footer #115
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
2 commits
Select commit
Hold shift + click to select a range
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| import GitHubIcon from '@node-core/ui-components/Icons/Social/GitHub'; | ||
| import LinkedInIcon from '@node-core/ui-components/Icons/Social/LinkedIn'; | ||
| import DiscordIcon from '@node-core/ui-components/Icons/Social/Discord'; | ||
| import XIcon from '@node-core/ui-components/Icons/Social/X'; | ||
| import { footer } from '#theme/site' with { type: 'json' }; | ||
|
|
||
|
avivkeller marked this conversation as resolved.
avivkeller marked this conversation as resolved.
avivkeller marked this conversation as resolved.
avivkeller marked this conversation as resolved.
|
||
| import Logo from '#theme/Logo'; | ||
| import styles from './index.module.css'; | ||
|
|
||
| const SOCIAL_ICONS = { | ||
| GitHub: GitHubIcon, | ||
| X: XIcon, | ||
| Discord: DiscordIcon, | ||
| LinkedIn: LinkedInIcon, | ||
| }; | ||
|
avivkeller marked this conversation as resolved.
|
||
|
|
||
| /** | ||
| * Site-wide footer with brand description, navigation columns, | ||
| * and social links. | ||
| */ | ||
| export default () => ( | ||
| <footer className={styles.footer}> | ||
| <div className={styles.inner}> | ||
| <div className={styles.top}> | ||
| <div className={styles.brand}> | ||
| <a href="/" className={styles.logo} aria-label="webpack home"> | ||
| <Logo /> | ||
| <span className={styles.wordmark}>webpack</span> | ||
| </a> | ||
| <p className={styles.tagline}> | ||
| A static module bundler for modern JavaScript applications. | ||
| Maintained by the open-source community since 2012. | ||
| </p> | ||
| </div> | ||
|
|
||
| {footer.groups.map(section => ( | ||
| <nav | ||
| key={section.title} | ||
| className={styles.section} | ||
| aria-label={section.title} | ||
| > | ||
| <h2 className={styles.heading}>{section.title}</h2> | ||
| <ul className={styles.list}> | ||
| {section.links.map(({ text, link }) => ( | ||
| <li key={text}> | ||
| <a href={link} className={styles.link}> | ||
| {text} | ||
| </a> | ||
| </li> | ||
| ))} | ||
| </ul> | ||
| </nav> | ||
| ))} | ||
| </div> | ||
|
|
||
| <div className={styles.bottom}> | ||
| <p className={styles.legal}> | ||
| © <a href="https://openjsf.org">OpenJS Foundation</a> and webpack | ||
| contributors. All rights reserved. The{' '} | ||
| <a href="https://openjsf.org">OpenJS Foundation</a> has registered | ||
| trademarks and uses trademarks. For a list of trademarks of the{' '} | ||
| <a href="https://openjsf.org">OpenJS Foundation</a>, please see our{' '} | ||
| <a href="https://trademark-policy.openjsf.org">Trademark Policy</a>{' '} | ||
| and <a href="https://trademark-list.openjsf.org">Trademark List</a>. | ||
| Trademarks and logos not indicated on the{' '} | ||
| <a href="https://trademark-list.openjsf.org"> | ||
| list of OpenJS Foundation trademarks | ||
| </a>{' '} | ||
| are trademarks™ or registered® trademarks of their | ||
| respective holders. Use of them does not imply any affiliation with or | ||
| endorsement by them. | ||
| </p> | ||
| <ul className={styles.social}> | ||
| {footer.socialLinks.map(({ label, link }) => { | ||
| const Icon = SOCIAL_ICONS[label]; | ||
|
|
||
| return ( | ||
| <li key={label}> | ||
| <a | ||
| href={link} | ||
| className={styles.socialLink} | ||
| aria-label={label} | ||
| target="_blank" | ||
| rel="noreferrer noopener" | ||
| > | ||
| <Icon width={20} height={20} /> | ||
| </a> | ||
|
avivkeller marked this conversation as resolved.
|
||
| </li> | ||
| ); | ||
| })} | ||
| </ul> | ||
| </div> | ||
|
avivkeller marked this conversation as resolved.
avivkeller marked this conversation as resolved.
avivkeller marked this conversation as resolved.
avivkeller marked this conversation as resolved.
|
||
| </div> | ||
| </footer> | ||
| ); | ||
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,134 @@ | ||
| .footer { | ||
| border-top: 1px solid var(--color-neutral-900); | ||
| background-color: var(--color-neutral-950); | ||
| color: var(--color-neutral-500); | ||
| } | ||
|
|
||
| .inner { | ||
| max-width: 80rem; | ||
| margin-inline: auto; | ||
| padding: 3rem 1.5rem 1.5rem; | ||
| } | ||
|
|
||
| .top { | ||
| display: grid; | ||
| grid-template-columns: 1fr; | ||
| gap: 2.5rem; | ||
| } | ||
|
|
||
| @media (min-width: 40rem) { | ||
| .top { | ||
| grid-template-columns: repeat(2, 1fr); | ||
| } | ||
| } | ||
|
|
||
| @media (min-width: 64rem) { | ||
| .top { | ||
| grid-template-columns: 1.5fr repeat(4, 1fr); | ||
| gap: 2rem; | ||
| } | ||
| } | ||
|
|
||
| .brand { | ||
| display: flex; | ||
| flex-direction: column; | ||
| gap: 1rem; | ||
| max-width: 18rem; | ||
| } | ||
|
|
||
| .logo { | ||
| display: inline-flex; | ||
| align-items: center; | ||
| gap: 0.5rem; | ||
| text-decoration: none; | ||
| } | ||
|
|
||
| .wordmark { | ||
| font-size: 1.125rem; | ||
| font-weight: 600; | ||
| color: var(--color-neutral-50); | ||
| } | ||
|
|
||
| .tagline { | ||
| margin: 0; | ||
| font-size: 0.875rem; | ||
| line-height: 1.6; | ||
| color: var(--color-neutral-600); | ||
| } | ||
|
|
||
| .section { | ||
| display: flex; | ||
| flex-direction: column; | ||
| gap: 0.875rem; | ||
| } | ||
|
|
||
| .heading { | ||
| margin: 0; | ||
| font-size: 0.75rem; | ||
| font-weight: 600; | ||
| letter-spacing: 0.08em; | ||
| text-transform: uppercase; | ||
| color: var(--color-green-300); | ||
| } | ||
|
|
||
| .list { | ||
| display: flex; | ||
| flex-direction: column; | ||
| gap: 0.625rem; | ||
| margin: 0; | ||
| padding: 0; | ||
| list-style: none; | ||
| } | ||
|
|
||
| .link { | ||
| font-size: 0.9375rem; | ||
| color: var(--color-neutral-300); | ||
| text-decoration: none; | ||
| transition: color 0.15s ease; | ||
| } | ||
|
|
||
| .link:hover { | ||
| color: var(--color-green-300); | ||
| } | ||
|
|
||
| .bottom { | ||
| display: flex; | ||
| flex-direction: column; | ||
| gap: 1rem; | ||
| align-items: center; | ||
| margin-top: 2.5rem; | ||
| padding-top: 1.5rem; | ||
| border-top: 1px solid var(--color-neutral-900); | ||
| } | ||
|
|
||
| @media (min-width: 40rem) { | ||
| .bottom { | ||
| flex-direction: row; | ||
| justify-content: space-between; | ||
| } | ||
| } | ||
|
|
||
| .legal { | ||
| margin: 0; | ||
| font-size: 0.875rem; | ||
| color: var(--color-neutral-600); | ||
| } | ||
|
|
||
| .social { | ||
| display: flex; | ||
| align-items: center; | ||
| gap: 1rem; | ||
| margin: 0; | ||
| padding: 0; | ||
| list-style: none; | ||
| } | ||
|
|
||
| .socialLink { | ||
| display: inline-flex; | ||
| color: var(--color-neutral-500); | ||
| transition: color 0.15s ease; | ||
| } | ||
|
|
||
| .socialLink:hover { | ||
| color: var(--color-neutral-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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,13 @@ | ||
| import DefaultLayout from '@node-core/doc-kit/src/generators/web/ui/components/Layout/index.jsx'; | ||
| import HomeLayout from '../layouts/Home/index.jsx'; | ||
| import '../styles/theme.css'; | ||
|
|
||
| const LAYOUTS = { | ||
| home: HomeLayout, | ||
| }; | ||
|
|
||
| export default function Layout(props) { | ||
| return ( | ||
| <> | ||
| <DefaultLayout {...props} /> | ||
| </> | ||
| ); | ||
| const Component = LAYOUTS[props.metadata.layout] ?? DefaultLayout; | ||
|
|
||
| return <Component {...props} />; | ||
| } |
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,36 @@ | ||
| import ThemeToggle from '@node-core/ui-components/Common/ThemeToggle'; | ||
| import NavBar from '@node-core/ui-components/Containers/NavBar'; | ||
| import styles from '@node-core/ui-components/Containers/NavBar/index.module.css'; | ||
| import GitHubIcon from '@node-core/ui-components/Icons/Social/GitHub'; | ||
|
|
||
| import SearchBox from '@node-core/doc-kit/src/generators/web/ui/components/SearchBox'; | ||
| import { useTheme } from '@node-core/doc-kit/src/generators/web/ui/hooks/useTheme.mjs'; | ||
| import { navbar } from '#theme/site' with { type: 'json' }; | ||
| import Logo from '#theme/Logo'; | ||
|
|
||
| /** | ||
| * NavBar component that displays the headings, search, etc. | ||
| */ | ||
| export default ({ metadata }) => { | ||
| const [themePreference, setThemePreference] = useTheme(); | ||
|
|
||
| return ( | ||
| <NavBar | ||
| Logo={Logo} | ||
| sidebarItemTogglerAriaLabel="Toggle navigation menu" | ||
| navItems={navbar} | ||
| > | ||
| <SearchBox pathname={metadata.path} /> | ||
| <ThemeToggle | ||
| onChange={setThemePreference} | ||
| currentTheme={themePreference} | ||
| /> | ||
| <a | ||
| href="https://github.com/webpack/webpack" | ||
| className={styles.ghIconWrapper} | ||
| > | ||
|
avivkeller marked this conversation as resolved.
|
||
| <GitHubIcon /> | ||
| </a> | ||
|
avivkeller marked this conversation as resolved.
avivkeller marked this conversation as resolved.
avivkeller marked this conversation as resolved.
avivkeller marked this conversation as resolved.
avivkeller marked this conversation as resolved.
|
||
| </NavBar> | ||
| ); | ||
| }; | ||
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,20 @@ | ||
| export default () => ( | ||
| <svg | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| viewBox="0 0 774 875.7" | ||
| width={30} | ||
| height={30} | ||
| > | ||
| <path fill="#FFF" d="M387 0l387 218.9v437.9L387 875.7 0 656.8V218.9z" /> | ||
|
|
||
| <path | ||
| fill="#8ed6fb" | ||
| d="M704.9 641.7L399.8 814.3V679.9l190.1-104.6 115 66.4zm20.9-18.9V261.9l-111.6 64.5v232l111.6 64.4zM67.9 641.7L373 814.3V679.9L182.8 575.3 67.9 641.7zM47 622.8V261.9l111.6 64.5v232L47 622.8zm13.1-384.3L373 61.5v129.9L172.5 301.7l-1.6.9-110.8-64.1zm652.6 0l-312.9-177v129.9l200.5 110.2 1.6.9 110.8-64z" | ||
| /> | ||
|
|
||
| <path | ||
| fill="#1c78c0" | ||
| d="M373 649.3L185.4 546.1V341.8L373 450.1v199.2zm26.8 0l187.6-103.1V341.8L399.8 450.1v199.2zm-13.4-207zM198.1 318.2l188.3-103.5 188.3 103.5-188.3 108.7-188.3-108.7z" | ||
| /> | ||
| </svg> | ||
| ); |
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 @@ | ||
| export default undefined; | ||
|
avivkeller marked this conversation as resolved.
|
||
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.
Uh oh!
There was an error while loading. Please reload this page.