-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
some refactor, change most components from svelte -> astro
- Loading branch information
Showing
26 changed files
with
400 additions
and
373 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
--- | ||
import { cn } from "../utils"; | ||
import type { HTMLAttributes } from "astro/types"; | ||
export type Props = HTMLAttributes<"button">; | ||
const { class: className, ...props } = Astro.props; | ||
--- | ||
|
||
<button | ||
class={cn( | ||
"flex items-center justify-center text-base-950 hover:text-base-600 dark:text-base-50 dark:hover:text-base-400", | ||
className | ||
)} | ||
data-theme-toggle | ||
{...props} | ||
> | ||
<span class="sr-only">Theme Toggle</span> | ||
|
||
<!-- Dark Mode Icon --> | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
fill="none" | ||
viewBox="0 0 24 24" | ||
stroke-width="1.5" | ||
stroke="currentColor" | ||
class="w-6 h-6 hidden dark:block" | ||
> | ||
<path | ||
stroke-linecap="round" | ||
stroke-linejoin="round" | ||
d="M21.752 15.002A9.718 9.718 0 0118 15.75c-5.385 0-9.75-4.365-9.75-9.75 0-1.33.266-2.597.748-3.752A9.753 9.753 0 003 11.25C3 16.635 7.365 21 12.75 21a9.753 9.753 0 009.002-5.998z" | ||
></path> | ||
</svg> | ||
|
||
<!-- Light Mode Icon --> | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
fill="none" | ||
viewBox="0 0 24 24" | ||
stroke-width="1.5" | ||
stroke="currentColor" | ||
class="w-6 h-6 block dark:hidden" | ||
> | ||
<path | ||
stroke-linecap="round" | ||
stroke-linejoin="round" | ||
d="M12 3v2.25m6.364.386l-1.591 1.591M21 12h-2.25m-.386 | ||
6.364l-1.591-1.591M12 18.75V21m-4.773-4.227l-1.591 | ||
1.591M5.25 12H3m4.227-4.773L5.636 | ||
5.636M15.75 12a3.75 3.75 0 11-7.5 0 3.75 3.75 0 | ||
017.5 0z" | ||
></path> | ||
</svg> | ||
</button> | ||
|
||
<script> | ||
(() => { | ||
let darkMode = false; | ||
|
||
function setTheme(dark: boolean) { | ||
const root = document.documentElement; | ||
if (dark) { | ||
root.classList.add("dark"); | ||
} else { | ||
root.classList.remove("dark"); | ||
} | ||
} | ||
|
||
function toggleTheme() { | ||
darkMode = !darkMode; | ||
localStorage.setItem("darkMode", JSON.stringify(darkMode)); | ||
setTheme(darkMode); | ||
} | ||
|
||
// Initialize theme on page load | ||
const savedDarkMode = localStorage.getItem("darkMode"); | ||
if (savedDarkMode !== null) { | ||
darkMode = JSON.parse(savedDarkMode); | ||
} else { | ||
darkMode = window.matchMedia("(prefers-color-scheme: dark)").matches; | ||
} | ||
setTheme(darkMode); | ||
|
||
// Listen to system theme changes | ||
window | ||
.matchMedia("(prefers-color-scheme: dark)") | ||
.addEventListener("change", (e) => e.matches && toggleTheme()); | ||
|
||
window | ||
.matchMedia("(prefers-color-scheme: light)") | ||
.addEventListener("change", (e) => e.matches && toggleTheme()); | ||
|
||
// Add click event to toggle button | ||
document | ||
.querySelector("button[data-theme-toggle]") | ||
?.addEventListener("click", toggleTheme); | ||
})(); | ||
</script> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
import { cn } from "../../utils"; | ||
interface Props { | ||
title: string; | ||
class?: string; | ||
} | ||
const { title, class: className } = Astro.props; | ||
--- | ||
|
||
<div | ||
class={cn( | ||
"rounded-xl bg-red-50 dark:bg-red-500/5 p-4 dark:ring-1 dark:ring-red-500/10 not-prose max-w-full", | ||
className | ||
)} | ||
> | ||
<div class="flex"> | ||
<div class="flex-shrink-0"> | ||
<svg | ||
class="h-5 w-5 text-red-500" | ||
viewBox="0 0 20 20" | ||
fill="currentColor" | ||
aria-hidden="true" | ||
> | ||
<path | ||
fill-rule="evenodd" | ||
d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.28 7.22a.75.75 0 00-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 101.06 1.06L10 11.06l1.72 1.72a.75.75 0 101.06-1.06L11.06 10l1.72-1.72a.75.75 0 00-1.06-1.06L10 8.94 8.28 7.22z" | ||
clip-rule="evenodd"></path> | ||
</svg> | ||
</div> | ||
<div class="ml-3"> | ||
<h3 class="text-sm font-medium text-red-800 dark:text-red-500"> | ||
{title} | ||
</h3> | ||
<div class="mt-2 text-sm text-red-700 dark:text-red-400"> | ||
<slot /> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.