Working webapp
This commit is contained in:
1 parent
262e2971a1
commit
75f0841978
11 files changed
+3713
-134
No files matched your search
@@ -0,0 +1,46 @@
|
||||
import { createAppUseStyles } from "./theme";
|
||||
|
||||
export const usePageTheme = createAppUseStyles(theme => ({
|
||||
page: {
|
||||
// dims
|
||||
height: '100vh',
|
||||
width: '100vw',
|
||||
margin: 0,
|
||||
padding: 0,
|
||||
overflow: 'auto',
|
||||
maxWidth: '100vw',
|
||||
maxHeight: '100vh',
|
||||
|
||||
// font
|
||||
fontSize: '16px',
|
||||
fontFamily: 'Tahoma, Geneva, sans-serif',
|
||||
color: theme.primaryAccent,
|
||||
|
||||
// background
|
||||
backgroundColor: theme.primary,
|
||||
|
||||
// children
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
justifyContent: 'flex-start',
|
||||
alignItems: 'center',
|
||||
|
||||
'> div': {
|
||||
flex: 1,
|
||||
},
|
||||
|
||||
// scroll
|
||||
'&::-webkit-scrollbar': {
|
||||
width: '10px'
|
||||
},
|
||||
'&::-webkit-scrollbar-track': {
|
||||
background: theme.secondary,
|
||||
},
|
||||
'&::-webkit-scrollbar-thumb': {
|
||||
background: theme.secondaryAccent,
|
||||
},
|
||||
'&::-webkit-scrollbar-thumb:hover': {
|
||||
background: theme.primaryAccent,
|
||||
},
|
||||
}
|
||||
}))
|
||||
@@ -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};
|
||||
}
|
||||
Reference in new issue
Block a user