feat: new design progress

This commit is contained in:
2024-05-17 23:17:15 +01:00
parent 1b5fa7a5ca
commit 75c90e9dc4
36 changed files with 675 additions and 375 deletions

View File

@ -0,0 +1,28 @@
import { ReactNode, createContext, useState } from "react";
interface LayoutContextType {
leftNav: boolean;
theme: string;
update: (fn: (c: LayoutContextType) => LayoutContextType) => void;
}
const defaultLayoutContext: LayoutContextType = {
leftNav: true,
theme: "",
update: c => c,
};
export const LayoutContext = createContext<LayoutContextType>(defaultLayoutContext);
export function LayoutContextProvider({ children }: { children: ReactNode }) {
const [value, setValue] = useState<LayoutContextType>(defaultLayoutContext);
return (
<LayoutContext.Provider
value={{
...value,
update: fn => {
setValue(fn);
},
}}>
{children}
</LayoutContext.Provider>
);
}