fix(www): Add a global nav (#895)

This commit is contained in:
hashrock
2022-12-02 01:04:37 +09:00
committed by GitHub
parent 79e9ad017e
commit a0e3b91196
8 changed files with 88 additions and 85 deletions
+9 -9
View File
@@ -1,9 +1,7 @@
export default function NavigationBar(props: { active: string }) {
export default function NavigationBar(
props: { active: string; class?: string },
) {
const items = [
{
name: "Home",
href: "/",
},
{
name: "Docs",
href: "/docs",
@@ -17,15 +15,17 @@ export default function NavigationBar(props: { active: string }) {
href: "/components",
},
];
const isHome = props.active == "/";
return (
<nav class="bg-green-200 py-2">
<ul class="flex justify-center gap-8 mx-4">
<nav class={"flex " + props.class ?? ""}>
<ul class="flex justify-center items-center gap-4 mx-4 my-6">
{items.map((item) => (
<li>
<a
href={item.href}
class={`text-gray-600 hover:underline ${
class={`p-2 ${
isHome ? "text-green-900" : "text-gray-600"
} hover:underline ${
props.active == item.href ? "font-bold" : ""
}`}
>