mirror of
https://github.com/hzrd149/nostrudel.git
synced 2025-09-19 12:00:32 +02:00
switch default theme
This commit is contained in:
@@ -2,7 +2,7 @@ import React, { useMemo } from "react";
|
|||||||
import { ChakraProvider, localStorageManager } from "@chakra-ui/react";
|
import { ChakraProvider, localStorageManager } from "@chakra-ui/react";
|
||||||
|
|
||||||
import { SigningProvider } from "./signing-provider";
|
import { SigningProvider } from "./signing-provider";
|
||||||
import createTheme from "../theme";
|
import buildTheme from "../theme";
|
||||||
import useAppSettings from "../hooks/use-app-settings";
|
import useAppSettings from "../hooks/use-app-settings";
|
||||||
import DeleteEventProvider from "./delete-event-provider";
|
import DeleteEventProvider from "./delete-event-provider";
|
||||||
import { InvoiceModalProvider } from "./invoice-modal";
|
import { InvoiceModalProvider } from "./invoice-modal";
|
||||||
@@ -16,7 +16,7 @@ import MuteModalProvider from "./mute-modal-provider";
|
|||||||
export const GlobalProviders = ({ children }: { children: React.ReactNode }) => {
|
export const GlobalProviders = ({ children }: { children: React.ReactNode }) => {
|
||||||
const { theme: themeName, primaryColor, maxPageWidth } = useAppSettings();
|
const { theme: themeName, primaryColor, maxPageWidth } = useAppSettings();
|
||||||
const theme = useMemo(
|
const theme = useMemo(
|
||||||
() => createTheme(themeName, primaryColor, maxPageWidth !== "none" ? maxPageWidth : undefined),
|
() => buildTheme(themeName, primaryColor, maxPageWidth !== "none" ? maxPageWidth : undefined),
|
||||||
[themeName, primaryColor, maxPageWidth],
|
[themeName, primaryColor, maxPageWidth],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@@ -7,7 +7,7 @@ import { buttonTheme } from "./components/button";
|
|||||||
import { drawerTheme } from "./components/drawer";
|
import { drawerTheme } from "./components/drawer";
|
||||||
import { modalTheme } from "./components/modal";
|
import { modalTheme } from "./components/modal";
|
||||||
|
|
||||||
const midnightTheme = extendTheme({
|
const defaultTheme = extendTheme({
|
||||||
colors: {
|
colors: {
|
||||||
gray: pallet(chroma.scale(["#d5d5d5", "#0e0e0e"]).colors(10)),
|
gray: pallet(chroma.scale(["#d5d5d5", "#0e0e0e"]).colors(10)),
|
||||||
},
|
},
|
||||||
@@ -27,4 +27,4 @@ const midnightTheme = extendTheme({
|
|||||||
},
|
},
|
||||||
} as DeepPartial<Theme>);
|
} as DeepPartial<Theme>);
|
||||||
|
|
||||||
export default midnightTheme;
|
export default defaultTheme;
|
@@ -2,7 +2,7 @@ import { extendTheme, Theme, DeepPartial } from "@chakra-ui/react";
|
|||||||
import { containerTheme } from "./container";
|
import { containerTheme } from "./container";
|
||||||
import chroma from "chroma-js";
|
import chroma from "chroma-js";
|
||||||
|
|
||||||
import midnightTheme from "./midnight";
|
import defaultTheme from "./default";
|
||||||
|
|
||||||
function pallet(colors: string[]) {
|
function pallet(colors: string[]) {
|
||||||
return [50, 100, 200, 300, 400, 500, 600, 700, 800, 900].reduce(
|
return [50, 100, 200, 300, 400, 500, 600, 700, 800, 900].reduce(
|
||||||
@@ -12,13 +12,13 @@ function pallet(colors: string[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getTheme(name: string) {
|
function getTheme(name: string) {
|
||||||
if (name === "midnight") return midnightTheme;
|
if (name === "default") return defaultTheme;
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
const breakpoints = ["sm", "md", "lg", "xl", "2xl"] as const;
|
const breakpoints = ["sm", "md", "lg", "xl", "2xl"] as const;
|
||||||
|
|
||||||
export default function createTheme(
|
export default function buildTheme(
|
||||||
themeName: string,
|
themeName: string,
|
||||||
primaryColor: string = "#8DB600",
|
primaryColor: string = "#8DB600",
|
||||||
maxBreakpoint?: (typeof breakpoints)[number],
|
maxBreakpoint?: (typeof breakpoints)[number],
|
||||||
|
@@ -39,7 +39,7 @@ export default function DisplaySettings() {
|
|||||||
</FormLabel>
|
</FormLabel>
|
||||||
<Select id="theme" {...register("theme")}>
|
<Select id="theme" {...register("theme")}>
|
||||||
<option value="default">Default</option>
|
<option value="default">Default</option>
|
||||||
<option value="midnight">Midnight</option>
|
<option value="chakraui">ChakraUI</option>
|
||||||
</Select>
|
</Select>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
|
Reference in New Issue
Block a user