Skip to content

Commit

Permalink
added icons
Browse files Browse the repository at this point in the history
  • Loading branch information
jhilker98 committed Mar 12, 2024
1 parent a4b86a7 commit 9b08954
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 4 deletions.
14 changes: 13 additions & 1 deletion src/components/Header.astro
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,25 @@ const currentPath = pathname.slice(1); // remove the first "/"
class="h-full p-3 duration-75 hover:backdrop-brightness-75 inline-flex place-items-center dark:hover:backdrop-brightness-125"
aria-label="Toggle Dark Mode"
@click="darkMode = !darkMode">

<Icon
name="heroicons:sun-solid"
class="text-branding-white hidden dark:inline-block w-5 h-5"
/>
<Icon
name="heroicons:moon-solid"
class="text-branding-black dark:hidden inline-block w-5 h-5"
/>
</button>
<button
type="button"
aria-label="Toggle mobile menu"
class="h-full p-3 hover:backdrop-brightness-75 dark:hover:backdrop-brightness-125 duration-150 lg:hidden text-branding-black dark:text-branding-white"
x-on:click="mobileOpen = !mobileOpen">
<Icon
name="heroicons:bars-3-20-solid"
class="w-5 h-5 transition duration-150 text-branding-black dark:text-branding-white"
:class="{'rotate-90': mobileOpen === true}"
/>
</button>
</div>
</div>
Expand Down
5 changes: 5 additions & 0 deletions src/components/MobileSidebar.astro
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ import { Icon } from "astro-icon/components";
aria-label="Close mobile sidebar"
class="p-4 transition hover:backdrop-brightness-75 dark:hover:backdrop-brightness-125 duration-100"
@click="sidebarOpen = !sidebarOpen">
<Icon
name="heroicons:x-mark-solid"
class="fill-branding-white h-5 w-5 duration-150"
:class="{'rotate-45': !sidebarOpen}"
/>
</button>
</div>
<div
Expand Down
3 changes: 3 additions & 0 deletions src/components/Pagination.astro
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
// component imports
import { Icon } from "astro-icon/components";
const { prevUrl, nextUrl } = Astro.props;
---

Expand All @@ -11,6 +12,7 @@ const { prevUrl, nextUrl } = Astro.props;
<a
href={prevUrl}
class="align-baseline p-2 bg-branding-navy text-white uppercase rounded justify-start mr-auto ml-0">
<Icon name="heroicons:backward-20-solid" class="inline w-5 h-5 mb-1" />
Previous
</a>
)
Expand All @@ -22,6 +24,7 @@ const { prevUrl, nextUrl } = Astro.props;
href={nextUrl}
class="align-baseline p-2 bg-branding-navy text-white uppercase rounded justify-end ml-auto mr-0">
Next
<Icon name="heroicons:forward-20-solid" class="inline w-5 h-5 mb-1" />
</a>
)
}
Expand Down
6 changes: 5 additions & 1 deletion src/components/blog/PostHeader.astro
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ interface Props {
}
import { formatPostDate, hashtagPostTags, slugifyUrl } from "@lib/utils";
import { Icon } from "astro-icon/components";
const {
title,
pubDate,
Expand All @@ -20,6 +22,7 @@ const postTags = hashtagPostTags(tags);

<header class="align-baseline">
<h1 class="mt-1 text-wrap-balance">{title}</h1>
<Icon name="mdi:calendar" class="w-5 mb-1 mr-1 inline-block" />
<span class="font-bold mr-1 dark:text-neutral-300 text-neutral-700"
>Posted:</span
>
Expand All @@ -38,6 +41,7 @@ const postTags = hashtagPostTags(tags);
}

<div class="block">
<Icon name="heroicons:tag-20-solid" class="h-5 w-5 mr-1 inline mb-1" />
<strong class="mr-1 dark:text-neutral-300 text-neutral-700">Tags:</strong>
{
postTags.map((tag, index) => {
Expand All @@ -55,7 +59,7 @@ const postTags = hashtagPostTags(tags);
}
</div>
<div class="block">
<MdiFolderOpen class="h-5 w-5 mr-1 inline mb-1" />
<Icon name="mdi:folder-open" class="h-5 w-5 mr-1 inline mb-1" />
<strong class="mr-1 dark:text-neutral-300 text-neutral-700"
>Categories:</strong
>
Expand Down
4 changes: 2 additions & 2 deletions src/layouts/BaseLayout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const { title, description } = Astro.props;

<html
lang="en"
x-data="{darkMode: false}"
x-data="{darkMode: false, sidebarOpen: false}"
x-init="darkMode = JSON.parse(localStorage.getItem('darkMode')); $watch('darkMode', value => JSON.stringify(localStorage.setItem('darkMode', value)))"
:data-theme="darkMode === true ? 'dark' : 'light'">
<head>
Expand Down Expand Up @@ -57,6 +57,6 @@ const { title, description } = Astro.props;
<slot />
</main>
</div>
<!-- <MobileSidebar /> -->
<MobileSidebar />
</body>
</html>

0 comments on commit 9b08954

Please sign in to comment.