Skip to content

Commit f9a016c

Browse files
committed
wip
1 parent 1815887 commit f9a016c

2 files changed

Lines changed: 9 additions & 19 deletions

File tree

osmium/src/index.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { fileURLToPath } from "node:url";
55
export interface OsmiumThemeConfig {
66
projects?: ProjectConfig[];
77
sidebar?: SidebarConfig;
8-
nav?: Array<NavItem>;
98
reportPagePath?: string;
109
fonts?: { [K in keyof typeof allFonts]?: false } | false;
1110
}
@@ -15,12 +14,6 @@ export interface ProjectConfig {
1514
name: string;
1615
}
1716

18-
export interface NavItem {
19-
text: string;
20-
link: string;
21-
activeMatch?: string;
22-
}
23-
2417
type Font = { cssPath: string; preloadFontPath: string; fontType: string };
2518

2619
const allFonts = {

osmium/src/ui/layout/main-header.tsx

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import {
22
ComponentProps,
33
For,
44
Show,
5-
createMemo,
65
createSignal,
76
onCleanup,
87
onMount,
@@ -31,7 +30,7 @@ interface NavLinkProps extends ComponentProps<"a"> {
3130
function NavLink(props: NavLinkProps) {
3231
return (
3332
<a
34-
class="duration-250 relative overflow-hidden border-b-2 px-2 text-slate-900 drop-shadow-[0_35px_35px_rgba(1,1,1,1.75)] transition-all dark:text-slate-200"
33+
class="relative overflow-hidden border-b-2 px-2 text-slate-900 drop-shadow-[0_35px_35px_rgba(1,1,1,1.75)] transition-all duration-250 dark:text-slate-200"
3534
classList={{
3635
"border-b-blue-500 dark:bottom-b-blue-500": props.active,
3736
"border-transparent": !props.active,
@@ -87,7 +86,7 @@ export function MainHeader(props: MainHeaderProps) {
8786
"dark:bg-transparent bg-transparent": !isScrolled(),
8887
}}
8988
>
90-
<div class="mx-auto grid w-full max-w-8xl grid-cols-2 items-center px-4 py-2 lg:grid-cols-[1fr_2fr_1fr]">
89+
<div class="max-w-8xl mx-auto grid w-full grid-cols-2 items-center px-4 py-2 lg:grid-cols-[1fr_2fr_1fr]">
9190
<div class="flex justify-start gap-2">
9291
<div class="flex lg:hidden">
9392
<MobileNavigation />
@@ -97,24 +96,22 @@ export function MainHeader(props: MainHeaderProps) {
9796
</a>
9897
</div>
9998

100-
<Show when={config().themeConfig?.nav}>
101-
{(nav) => (
102-
<For each={nav()}>
103-
{(item) => {
99+
<Show when={config().themeConfig?.projects}>
100+
{(projects) => (
101+
<For each={projects()}>
102+
{(p) => {
104103
const match = useMatch(() =>
105-
locale.applyPathPrefix(
106-
`${item.activeMatch ?? item.link}/*rest`
107-
)
104+
locale.applyPathPrefix(`${p.path}/*rest`)
108105
);
109106

110107
return (
111108
<li>
112109
<NavLink
113-
href={locale.applyPathPrefix(item.link)}
110+
href={locale.applyPathPrefix(p.path)}
114111
data-matched={match() !== undefined ? true : undefined}
115112
onClick={() => setNavOpen(false)}
116113
>
117-
{item.text}
114+
{p.name}
118115
</NavLink>
119116
</li>
120117
);

0 commit comments

Comments
 (0)