Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates #20

Merged
merged 3 commits into from
Oct 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Install Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x
deno-version: v2.x

- name: Build step
run: "deno task build"
Expand Down
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@
"jsx": "react-jsx",
"jsxImportSource": "preact"
},
"nodeModulesDir": true
"nodeModulesDir": "auto"
}
2 changes: 1 addition & 1 deletion islands/site-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export default function SiteHeader({ children }: Props) {
</header>
{showMenu && (
<div
className="fixed top-16 z-30 w-full overflow-hidden border-b bg-background/80 transition-transform duration-500 md:hidden translate-y-1px"
className="fixed top-16 z-30 w-full overflow-hidden border-b bg-background/80 transition-transform duration-500 md:hidden"
aria-hidden={!showMenu}
>
<div className="container flex h-full flex-col items-center justify-stretch px-4 pb-2">
Expand Down
12 changes: 9 additions & 3 deletions islands/theme-toggle.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
import { useSignal } from "@preact/signals";
import { signal } from "@preact/signals";

import { Button } from "../components/ui/Button.tsx";
import { Icons } from "../components/icons.tsx";

export function ThemeToggle() {
const theme = useSignal("light");
export const theme = signal("dark");

export function ThemeToggle() {
return (
<Button
variant="ghost"
size="sm"
onClick={() => {
theme.value = theme.value === "light" ? "dark" : "light";
if (theme.value === "light") {
document.documentElement.classList.remove("dark");
} else {
document.documentElement.classList.add("dark");
}

console.log(theme.value);
}}
>
Expand Down
4 changes: 3 additions & 1 deletion routes/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ import { siteConfig } from "../config/site.ts";
import MainNav from "../components/main-nav.tsx";
import SiteHeader from "../islands/site-header.tsx";

import { theme } from "../islands/theme-toggle.tsx";

export default function App({ Component, url }: PageProps) {
return (
<html class="dark">
<html className={theme.value}>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
Expand Down
14 changes: 5 additions & 9 deletions util/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,12 @@ export function cn(...inputs: ClassValue[]) {
}

export function getDomain(hostname: string) {
try {
const domainParts = hostname.split(".");
const domainParts = hostname.split(".");

const domain = `${domainParts[domainParts.length - 1]}
${domainParts[domainParts.length]}`;
const subdomain = hostname.split(domain)[0];
return { domain, subdomain };
} catch (e) {
throw new Error(e.message);
}
const domain = `${domainParts[domainParts.length - 1]}
${domainParts[domainParts.length]}`;
const subdomain = hostname.split(domain)[0];
return { domain, subdomain };
}

export const RESERVED = [
Expand Down