Skip to content

Commit

Permalink
Add mobile themeing
Browse files Browse the repository at this point in the history
  • Loading branch information
DamitusThyYeetus123 committed Dec 3, 2024
1 parent c8855c8 commit 078f533
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 9 deletions.
62 changes: 56 additions & 6 deletions src/components/Navbar.astro
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { siteLink } from "@utils/links";
---

<div
class="flex flex-row flex-wrap my-1 mx-20 p-3 justify-between items-center"
class="flex flex-row flex-wrap my-1 md:mx-20 mx-5 p-3 justify-between items-center"
>
<div class="flex justify-self-start">
<a href={origin + siteLink(`${lang}/`)} class="text-2xl">Sherpa</a>
Expand All @@ -20,24 +20,74 @@ import { siteLink } from "@utils/links";
<div
class="flex justify-self-end justify-end flex-row items-center space-x-4"
>
<div class="text-md justify-between space-x-2">
<ul
class="md:flex flex-col md:flex-row text-center w-full text-md space-x-2 md:justify-around hidden"
>
<li>
<a href={origin + siteLink(`${lang}/`)} class="hover:text-theme-accent1"
>Home</a
>
</li>
<li>
<a
href={origin + siteLink(`${lang}/preface/`)}
class="hover:text-theme-accent1">Preface</a
>
</li>
<li>
<a
href={origin + siteLink(`${lang}/why-nixos/`)}
class="hover:text-theme-accent1">Why NixOS?</a
>
</li>
<li>
<a
href={origin + siteLink(`${lang}/docs/`)}
class="hover:text-theme-accent1">Get Started</a
>
</li>
</ul>
<div id="burger" class="md:hidden">
<div class="h-0.5 w-6 my-1.5 bg-theme-600"></div>
<div class="h-0.5 w-6 my-1.5 bg-theme-600"></div>
<div class="h-0.5 w-6 my-1.5 bg-theme-600"></div>
</div>
<Spacer />
<ThemeSwitch />
</div>
<ul
id="mobile-links"
class="flex justify-around my-2 flex-row text-center w-full text-md space-x-2 hidden"
>
<li>
<a href={origin + siteLink(`${lang}/`)} class="hover:text-theme-accent1"
>Home</a
>
</li>
<li>
<a
href={origin + siteLink(`${lang}/preface/`)}
class="hover:text-theme-accent1">Preface</a
>
</li>
<li>
<a
href={origin + siteLink(`${lang}/why-nixos/`)}
class="hover:text-theme-accent1">Why NixOS?</a
>
</li>
<li>
<a
href={origin + siteLink(`${lang}/docs/`)}
class="hover:text-theme-accent1">Get Started</a
>
</div>
<Spacer />
<ThemeSwitch />
</div>
</li>
</ul>
<script>
const burger = document.getElementById("burger");
const links = document.getElementById("mobile-links");
burger?.addEventListener("click", () => {
links?.classList.toggle("hidden");
});
</script>
</div>
2 changes: 1 addition & 1 deletion src/pages/[lang]/docs/[...slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const { Content } = await render(entry);

<Layout>
<div
class="prose prose-test justify-center justify-items-center max-w-none lg:prose-xl"
class="prose prose-test justify-center justify-items-center max-w-none prose-sm px-2 md:prose-lg lg:prose-xl"
>
<h1>{entry.data.title}</h1>
<Content />
Expand Down
2 changes: 1 addition & 1 deletion src/pages/[lang]/preface.astro
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const { Content } = await render(entry);

<Layout>
<div
class="prose prose-test justify-center justify-items-center max-w-none lg:prose-xl"
class="prose prose-test justify-center justify-items-center max-w-none prose-sm px-2 md:prose-lg lg:prose-xl"
>
<h1>{entry.data.title}</h1>
<Content />
Expand Down
2 changes: 1 addition & 1 deletion src/pages/[lang]/why-nixos.astro
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const { Content } = await render(entry);

<Layout>
<div
class="prose prose-test justify-center justify-items-center max-w-none lg:prose-xl"
class="prose prose-test justify-center justify-items-center max-w-none prose-sm px-2 md:prose-lg lg:prose-xl"
>
<h1>{entry.data.title}</h1>
<Content />
Expand Down

0 comments on commit 078f533

Please sign in to comment.