mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
- Add Cloudflare Pages deployment for landing page (snapotter.com) and docs (docs.snapotter.com) - Create deploy-landing.yml and update deploy-docs.yml workflows - Update CI to ignore apps/landing/** paths - Fix logo transparency (remove white background) across all apps - Recreate social-preview.png with SnapOtter branding - Update all docs URLs from GitHub Pages to docs.snapotter.com - Update VitePress config: light theme default, fix llms.txt paths - Add .vitepress/cache/ and .env.* to gitignore
31 lines
862 B
TypeScript
31 lines
862 B
TypeScript
import { create } from "zustand";
|
|
import { persist } from "zustand/middleware";
|
|
|
|
type Theme = "light" | "dark" | "system";
|
|
|
|
interface ThemeStore {
|
|
theme: Theme;
|
|
setTheme: (theme: Theme) => void;
|
|
resolvedTheme: "light" | "dark";
|
|
}
|
|
|
|
function getSystemTheme(): "light" | "dark" {
|
|
if (typeof window === "undefined") return "light";
|
|
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
}
|
|
|
|
export const useThemeStore = create<ThemeStore>()(
|
|
persist(
|
|
(set) => ({
|
|
theme: "light" as Theme,
|
|
resolvedTheme: "light" as const,
|
|
setTheme: (theme) => {
|
|
const resolved = theme === "system" ? getSystemTheme() : theme;
|
|
document.documentElement.classList.toggle("dark", resolved === "dark");
|
|
set({ theme, resolvedTheme: resolved });
|
|
},
|
|
}),
|
|
{ name: "snapotter-theme" },
|
|
),
|
|
);
|