Working webapp

This commit is contained in:
ari committed 2021-11-24 13:19:34 -05:00
1 parent 262e2971a1
commit 75f0841978
11 files changed
+3713 -134

No files matched your search

+37
View File
@@ -0,0 +1,37 @@
import { Classes } from "jss";
import { Context, createContext } from "react"
import { createUseStyles, Styles } from "react-jss";
import { createTheming } from "theming"
// import Color from 'color';
export const {
context: ThemeContext,
ThemeProvider,
useTheme,
} = createTheming(createContext({
primary: '#111111',
secondary: '#1c1c1c',
primaryAccent: '#bbbbbb',
secondaryAccent: '#929191',
condition: {
primaryColor: '#4f4f77',
},
red: '#ed0c0c',
redAccent: '#9f3a3a',
}));
export type GetThemeType<C extends Context<any>> = C extends Context<infer T> ? T : unknown;
export type ClassNamesOfStyle<F extends Function> = Record<keyof ReturnType<F>, string>;
export type AppTheme = GetThemeType<typeof ThemeContext>;
export const createAppUseStyles = <
Props extends {} = {},
C extends string = string,
>(f: (theme: AppTheme) => Styles<C, Props, AppTheme>) => (props: Props): {
classes: Classes<keyof Styles<C, Props, AppTheme>>,
theme: AppTheme,
} => {
const theme = useTheme();
const useStyles = createUseStyles<C,Props,AppTheme>(f)
const classes = useStyles({...props, theme}) as Classes<keyof Styles<C, Props, AppTheme>>;
return {classes, theme};
}