www: docs: feat: add dark mode (#2820)

- Added CSS vars for dark/light colors.
- Added dark/light theme toggle as Island

Fixes #2648

---------

Co-authored-by: Marvin Hagemeister <marvin@deno.com>
This commit is contained in:
David Monaghan
2025-02-04 11:58:05 +01:00
committed by GitHub
co-authored by Marvin Hagemeister
parent adf8b87a03
commit b1f2a989a5
16 changed files with 320 additions and 46 deletions
+12 -1
View File
@@ -1,3 +1,4 @@
import ThemeToggle from "../islands/ThemeToggle.tsx";
import * as Icons from "./Icons.tsx";
export default function NavigationBar(
@@ -18,6 +19,7 @@ export default function NavigationBar(
},
];
const isHome = props.active == "/";
const isDocs = props.active == "/docs";
return (
<nav class={"flex " + (props.class ?? "")} f-client-nav={false}>
<ul class="flex items-center gap-x-2 sm:gap-4 mx-4 my-2 sm:my-6 flex-wrap lg:mx-8 2xl:mr-0">
@@ -26,7 +28,11 @@ export default function NavigationBar(
<a
href={item.href}
class={`p-1 sm:p-2 ${
isHome ? "text-green-900" : "text-gray-600"
isHome
? "text-green-900"
: isDocs
? "text-foreground-secondary"
: "text-gray-600"
} hover:underline aria-[current]:font-bold`}
>
{item.name}
@@ -52,6 +58,11 @@ export default function NavigationBar(
<Icons.Discord />
</a>
</li>
{isDocs && (
<li class="flex items-center">
<ThemeToggle />
</li>
)}
</ul>
</nav>
);