Skip to content

Commit d9d684c

Browse files
Feature: Horizontal navbar (#56)
* Initial Commit Copied component from [notkesto-site](https://github.com/camargomau/notkesto-site). Replaced links in `LinksHeader.tsx` and made all `img src=` entries empty. * Fix: correct link destinations Added hyphens to `<a>` link destinations containing spaces * Update: add icons, trim CSS, trim link titles - Mobile breakpoint removed as redundant - the links utilise flexbox - Trimmed link titles: - 'Modding Tools' shortened to 'Tools' - Removed 'Projects' as that wiki section lacks content and its use-case is dubious * Update: implement mobile version of navbar - navbar uses `overflow: scroll` on mobile Also removed `<hr>` element below navbar to make appearance cleaner * Update: Highlight background of links on-hover - Removed flex and replaced with inline-block. - Placed `<svg>` link icons inside the `<a>` elements so they are part of the link - Hovering over the links highlights the background - Trimmed CSS further
1 parent 7330a90 commit d9d684c

File tree

4 files changed

+79
-1
lines changed

4 files changed

+79
-1
lines changed

quartz.layout.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as Component from "./quartz/components"
44
// components shared across all pages
55
export const sharedPageComponents: SharedLayout = {
66
head: Component.Head(),
7-
header: [],
7+
header: [Component.LinksHeader()],
88
footer: Component.Footer({
99
links: {
1010
GitHub: "https://github.com/morrowind-modding/wiki",

quartz/components/LinksHeader.tsx

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { QuartzComponentConstructor } from "./types"
2+
import style from "./styles/linksHeader.scss"
3+
4+
interface Options {
5+
links: Record<string, string>
6+
}
7+
8+
export default (() => {
9+
function LinksHeader() {
10+
return (
11+
<div>
12+
<div id="links-header">
13+
<a href="/Guides/">
14+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-book-open-check"><path d="M8 3H2v15h7c1.7 0 3 1.3 3 3V7c0-2.2-1.8-4-4-4Z"/><path d="m16 12 2 2 4-4"/><path d="M22 6V3h-6c-2.2 0-4 1.8-4 4v14c0-1.7 1.3-3 3-3h7v-2.3"/></svg>
15+
Guides</a>
16+
<a href="/Modding-Tools/">
17+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-wrench"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"/></svg>
18+
Tools</a>
19+
<a href="/TES3-Construction-Set/">
20+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-pencil-ruler"><path d="M13 7 8.7 2.7a2.41 2.41 0 0 0-3.4 0L2.7 5.3a2.41 2.41 0 0 0 0 3.4L7 13"/><path d="m8 6 2-2"/><path d="m18 16 2-2"/><path d="m17 11 4.3 4.3c.94.94.94 2.46 0 3.4l-2.6 2.6c-.94.94-2.46.94-3.4 0L11 17"/><path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"/><path d="m15 5 4 4"/></svg>
21+
Construction Set</a>
22+
<a href="/Programmers-Reference/">
23+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-file-json"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg>
24+
Programmers Reference</a>
25+
{/* <div>
26+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-globe"><circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/></svg>
27+
<a href="/Projects/">Projects</a>
28+
</div> */}
29+
{/* commented out 'Projects' as it has no content and its use-case is still dubious */}
30+
<a href="/MMW-Design--and--Planning/">
31+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-shield-alert"><path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"/><path d="M12 8v4"/><path d="M12 16h.01"/></svg>
32+
Contributing</a>
33+
</div>
34+
</div>
35+
)
36+
}
37+
38+
LinksHeader.css = style
39+
return LinksHeader
40+
}) satisfies QuartzComponentConstructor

quartz/components/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import RecentNotes from "./RecentNotes"
2121
import Breadcrumbs from "./Breadcrumbs"
2222

2323
import Comments from "./Comments"
24+
import LinksHeader from "./LinksHeader"
2425

2526
export {
2627
ArticleTitle,
@@ -45,4 +46,5 @@ export {
4546
RecentNotes,
4647
NotFound,
4748
Breadcrumbs,
49+
LinksHeader,
4850
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
@use "../../styles/variables.scss" as *;
2+
3+
header {
4+
display: block;
5+
margin-top: 1rem;
6+
}
7+
8+
#links-header {
9+
font-size: 1.2em;
10+
margin: 0 0.2em;
11+
12+
svg {
13+
height: 1em;
14+
margin: 0 0.3em 0 0;
15+
vertical-align: middle;
16+
color: var(--dark);
17+
}
18+
19+
a {
20+
display: inline-block;
21+
color: var(--dark);
22+
padding: 10px 15px;
23+
background-color: #8f9fa926;
24+
}
25+
26+
a:hover{
27+
background-color: #8f9fa93d;
28+
}
29+
}
30+
31+
@media screen and (max-width: $mobileBreakpoint) {
32+
#links-header {
33+
overflow: scroll;
34+
white-space: nowrap;
35+
}
36+
}

0 commit comments

Comments
 (0)