Skip to content

Commit

Permalink
fix: fix 404 page commissions dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
NoeTerrier committed Mar 16, 2024
1 parent 1a2c75a commit 16fe8b4
Showing 1 changed file with 39 additions and 38 deletions.
77 changes: 39 additions & 38 deletions app/src/components/NavigationBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ import { Schema } from "@/types/schema";
import Link from "next/link";
import { useRouter } from "next/router";

type LinkRef = {
title: string;
href: string;
};

function DropdownMenu({
head: button,
children,
Expand Down Expand Up @@ -43,39 +38,45 @@ export default function NavigationBar(props: {
L'Association {/* TODO: translation */}
</Link>

<DropdownMenu
head={
<Link className={styles.menuItem} href="/commissions">
Commissions
<i className={styles.arrow} />
</Link>
}
>
{props.commissions ? (
props.commissions.map((c) => {
if (c.name && c.slug) {
return (
<Link
key={c.slug}
href={`/commissions/${c.slug}`}
className={styles.menuItem}
>
{c.name}
</Link>
);
} else {
console.error(
`Missing \`name\` or \`slug\` in commission: ${JSON.stringify(
c
)}`
);
throw new Error("Invalid commission");
}
})
) : (
<></>
)}
</DropdownMenu>
{props.commissions ? (
<DropdownMenu
head={
<Link className={styles.menuItem} href="/commissions">
Commissions
<i className={styles.arrow} />
</Link>
}
>
{props.commissions ? (
props.commissions.map((c) => {
if (c.name && c.slug) {
return (
<Link
key={c.slug}
href={`/commissions/${c.slug}`}
className={styles.menuItem}
>
{c.name}
</Link>
);
} else {
console.error(
`Missing \`name\` or \`slug\` in commission: ${JSON.stringify(
c
)}`
);
throw new Error("Invalid commission");
}
})
) : (
<></>
)}
</DropdownMenu>
) : (
<Link className={styles.menuItem} href="/commissions">
Commissions
</Link>
)}

<Link className={styles.menuItem} href="/news">
News
Expand Down

0 comments on commit 16fe8b4

Please sign in to comment.