Skip to content

Commit fd472ae

Browse files
NavigationLinks component for displaying the links in the Navbar.
1 parent b6fcd6e commit fd472ae

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types"
2+
import style from "./styles/navigationlinks.scss"
3+
4+
// @ts-ignore
5+
import script from "./scripts/navigationlinks.inline"
6+
7+
interface Options {
8+
links: Record<string, string>
9+
}
10+
11+
export default ((opts?: Options) => {
12+
const NavigationLinks: QuartzComponent = (props: QuartzComponentProps) => {
13+
const links = opts?.links ?? []
14+
return (
15+
<nav class="nav-links">
16+
<button className="menu-btn">Menu</button>
17+
<ul class="links">
18+
{Object.entries(links).map(([text, link]) => (
19+
<li>
20+
<a href={link}>{text}</a>
21+
</li>
22+
))}
23+
</ul>
24+
</nav>
25+
)
26+
}
27+
28+
NavigationLinks.css = style
29+
NavigationLinks.afterDOMLoaded = script
30+
31+
return NavigationLinks
32+
}) satisfies QuartzComponentConstructor

0 commit comments

Comments
 (0)