mirror of
https://github.com/usememos/memos.git
synced 2025-12-17 22:28:52 +08:00
fix: satisfy checks
This commit is contained in:
parent
97cec0b57e
commit
2218286f2e
5 changed files with 18 additions and 25 deletions
|
|
@ -13,9 +13,9 @@ const THEME_ICONS: Record<string, JSX.Element> = {
|
||||||
system: <Monitor className="w-4 h-4" />,
|
system: <Monitor className="w-4 h-4" />,
|
||||||
default: <Sun className="w-4 h-4" />,
|
default: <Sun className="w-4 h-4" />,
|
||||||
"default-dark": <Moon className="w-4 h-4" />,
|
"default-dark": <Moon className="w-4 h-4" />,
|
||||||
|
midnight: <MoonStar className="w-4 h-4" />,
|
||||||
paper: <Palette className="w-4 h-4" />,
|
paper: <Palette className="w-4 h-4" />,
|
||||||
whitewall: <Wallpaper className="w-4 h-4" />,
|
whitewall: <Wallpaper className="w-4 h-4" />,
|
||||||
midnight: <MoonStar className="w-4 h-4" />,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const ThemeSelect = ({ value, onValueChange, className }: ThemeSelectProps = {}) => {
|
const ThemeSelect = ({ value, onValueChange, className }: ThemeSelectProps = {}) => {
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ import { createRequestKey } from "./store-utils";
|
||||||
/**
|
/**
|
||||||
* Valid theme options
|
* Valid theme options
|
||||||
*/
|
*/
|
||||||
const VALID_THEMES = ["system", "default", "default-dark", "paper", "whitewall", "midnight"] as const;
|
const VALID_THEMES = ["system", "default", "default-dark", "midnight", "paper", "whitewall"] as const;
|
||||||
export type Theme = (typeof VALID_THEMES)[number];
|
export type Theme = (typeof VALID_THEMES)[number];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -31,26 +31,19 @@
|
||||||
--sidebar-accent-foreground: oklch(0.92 0.003 270);
|
--sidebar-accent-foreground: oklch(0.92 0.003 270);
|
||||||
--sidebar-border: oklch(0.25 0.005 270);
|
--sidebar-border: oklch(0.25 0.005 270);
|
||||||
--sidebar-ring: oklch(0.7 0.08 290);
|
--sidebar-ring: oklch(0.7 0.08 290);
|
||||||
--font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
|
--font-sans:
|
||||||
"Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif,
|
ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif,
|
||||||
"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol",
|
"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
||||||
"Noto Color Emoji";
|
|
||||||
--font-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
|
--font-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
|
||||||
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
|
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
||||||
"Liberation Mono", "Courier New", monospace;
|
|
||||||
--radius: 0.5rem;
|
--radius: 0.5rem;
|
||||||
--shadow-2xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
|
--shadow-2xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
|
||||||
--shadow-xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
|
--shadow-xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
|
||||||
--shadow-sm: 0 1px 3px 0px hsl(0 0% 0% / 0.1),
|
--shadow-sm: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 1px 2px -1px hsl(0 0% 0% / 0.1);
|
||||||
0 1px 2px -1px hsl(0 0% 0% / 0.1);
|
--shadow: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 1px 2px -1px hsl(0 0% 0% / 0.1);
|
||||||
--shadow: 0 1px 3px 0px hsl(0 0% 0% / 0.1),
|
--shadow-md: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 2px 4px -1px hsl(0 0% 0% / 0.1);
|
||||||
0 1px 2px -1px hsl(0 0% 0% / 0.1);
|
--shadow-lg: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 4px 6px -1px hsl(0 0% 0% / 0.1);
|
||||||
--shadow-md: 0 1px 3px 0px hsl(0 0% 0% / 0.1),
|
--shadow-xl: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 8px 10px -1px hsl(0 0% 0% / 0.1);
|
||||||
0 2px 4px -1px hsl(0 0% 0% / 0.1);
|
|
||||||
--shadow-lg: 0 1px 3px 0px hsl(0 0% 0% / 0.1),
|
|
||||||
0 4px 6px -1px hsl(0 0% 0% / 0.1);
|
|
||||||
--shadow-xl: 0 1px 3px 0px hsl(0 0% 0% / 0.1),
|
|
||||||
0 8px 10px -1px hsl(0 0% 0% / 0.1);
|
|
||||||
--shadow-2xl: 0 1px 3px 0px hsl(0 0% 0% / 0.25);
|
--shadow-2xl: 0 1px 3px 0px hsl(0 0% 0% / 0.25);
|
||||||
--tracking-normal: 0em;
|
--tracking-normal: 0em;
|
||||||
--spacing: 0.25rem;
|
--spacing: 0.25rem;
|
||||||
|
|
@ -104,4 +97,4 @@
|
||||||
--shadow-lg: var(--shadow-lg);
|
--shadow-lg: var(--shadow-lg);
|
||||||
--shadow-xl: var(--shadow-xl);
|
--shadow-xl: var(--shadow-xl);
|
||||||
--shadow-2xl: var(--shadow-2xl);
|
--shadow-2xl: var(--shadow-2xl);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
2
web/src/types/modules/setting.d.ts
vendored
2
web/src/types/modules/setting.d.ts
vendored
|
|
@ -1 +1 @@
|
||||||
type Theme = "system" | "default" | "default-dark" | "paper" | "whitewall" | "midnight";
|
type Theme = "system" | "default" | "default-dark" | "midnight" | "paper" | "whitewall";
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,18 @@
|
||||||
import defaultDarkThemeContent from "../themes/default-dark.css?raw";
|
import defaultDarkThemeContent from "../themes/default-dark.css?raw";
|
||||||
|
import midnightThemeContent from "../themes/midnight.css?raw";
|
||||||
import paperThemeContent from "../themes/paper.css?raw";
|
import paperThemeContent from "../themes/paper.css?raw";
|
||||||
import whitewallThemeContent from "../themes/whitewall.css?raw";
|
import whitewallThemeContent from "../themes/whitewall.css?raw";
|
||||||
import midnightThemeContent from "../themes/midnight.css?raw";
|
|
||||||
|
|
||||||
const VALID_THEMES = ["system", "default", "default-dark", "paper", "whitewall", "midnight"] as const;
|
const VALID_THEMES = ["system", "default", "default-dark", "midnight", "paper", "whitewall"] as const;
|
||||||
type ValidTheme = (typeof VALID_THEMES)[number];
|
type ValidTheme = (typeof VALID_THEMES)[number];
|
||||||
|
|
||||||
const THEME_CONTENT: Record<ValidTheme, string | null> = {
|
const THEME_CONTENT: Record<ValidTheme, string | null> = {
|
||||||
system: null, // System theme dynamically chooses between default and default-dark
|
system: null, // System theme dynamically chooses between default and default-dark
|
||||||
default: null,
|
default: null,
|
||||||
"default-dark": defaultDarkThemeContent,
|
"default-dark": defaultDarkThemeContent,
|
||||||
|
midnight: midnightThemeContent,
|
||||||
paper: paperThemeContent,
|
paper: paperThemeContent,
|
||||||
whitewall: whitewallThemeContent,
|
whitewall: whitewallThemeContent,
|
||||||
midnight: midnightThemeContent,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export interface ThemeOption {
|
export interface ThemeOption {
|
||||||
|
|
@ -24,9 +24,9 @@ export const THEME_OPTIONS: ThemeOption[] = [
|
||||||
{ value: "system", label: "Sync with system" },
|
{ value: "system", label: "Sync with system" },
|
||||||
{ value: "default", label: "Light" },
|
{ value: "default", label: "Light" },
|
||||||
{ value: "default-dark", label: "Dark" },
|
{ value: "default-dark", label: "Dark" },
|
||||||
|
{ value: "midnight", label: "Midnight" },
|
||||||
{ value: "paper", label: "Paper" },
|
{ value: "paper", label: "Paper" },
|
||||||
{ value: "whitewall", label: "Whitewall" },
|
{ value: "whitewall", label: "Whitewall" },
|
||||||
{ value: "midnight", label: "Midnight"},
|
|
||||||
];
|
];
|
||||||
|
|
||||||
const validateTheme = (theme: string): ValidTheme => {
|
const validateTheme = (theme: string): ValidTheme => {
|
||||||
|
|
@ -47,7 +47,7 @@ export const getSystemTheme = (): "default" | "default-dark" => {
|
||||||
* Resolves the actual theme to apply based on user preference
|
* Resolves the actual theme to apply based on user preference
|
||||||
* If theme is "system", returns the system preference, otherwise returns the theme as-is
|
* If theme is "system", returns the system preference, otherwise returns the theme as-is
|
||||||
*/
|
*/
|
||||||
export const resolveTheme = (theme: string): "default" | "default-dark" | "paper" | "whitewall" | "midnight" => {
|
export const resolveTheme = (theme: string): "default" | "default-dark" | "midnight" | "paper" | "whitewall" => {
|
||||||
if (theme === "system") {
|
if (theme === "system") {
|
||||||
return getSystemTheme();
|
return getSystemTheme();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue