2024-11-12 19:10:48 -05:00
import { typographyLevels } from "./constants" ;
2024-11-08 18:36:43 -05:00
const fontFamilyPrimary = '"Inter" , sans-serif' ;
// const fontFamilySecondary = '"Avenir", sans-serif';
2024-11-12 17:24:21 -05:00
/* TODO take the color out from here */
2024-11-09 08:01:14 -05:00
const shadow =
"0px 4px 24px -4px rgba(16, 24, 40, 0.08), 0px 3px 3px -3px rgba(16, 24, 40, 0.03)" ;
2024-11-12 19:10:48 -05:00
const baseTheme = ( palette ) => ({
2024-11-08 18:36:43 -05:00
typography : {
fontFamily : fontFamilyPrimary ,
2024-11-09 08:01:14 -05:00
fontSize : 14 ,
2024-11-08 18:36:43 -05:00
h1 : {
fontSize : typographyLevels . xl ,
2024-11-12 19:10:48 -05:00
color : palette . text . primary ,
2024-11-08 18:36:43 -05:00
fontWeight : 500 ,
},
h2 : {
fontSize : typographyLevels . l ,
2024-11-12 19:10:48 -05:00
color : palette . text . secondary ,
2024-11-08 18:36:43 -05:00
fontWeight : 400 ,
},
body1 : {
fontSize : typographyLevels . m ,
2024-11-12 19:10:48 -05:00
color : palette . text . tertiary ,
2024-11-08 18:36:43 -05:00
fontWeight : 400 ,
},
body2 : {
fontSize : typographyLevels . s ,
2024-11-12 19:10:48 -05:00
color : palette . text . tertiary ,
2024-11-08 18:36:43 -05:00
fontWeight : 400 ,
},
},
2024-11-29 10:45:30 -05:00
/* TODO we can skip using the callback functions on the next lines since we are already accessing it on line 10. That was the last thing I managed to do, so we are sort of doing it twice*/
2024-11-17 15:56:42 -05:00
2024-11-09 08:01:14 -05:00
spacing : 2 ,
2024-11-12 19:10:48 -05:00
/* TODO All these should live inside of a component*/
2024-11-09 08:01:14 -05:00
components : {
MuiButton : {
defaultProps : {
disableRipple : true ,
},
styleOverrides : {
root : ({ theme }) => ({
variants : [
{
props : ( props ) => props . variant === "group" ,
style : {
color : theme . palette . secondary . contrastText ,
backgroundColor : theme . palette . background . main ,
border : 1 ,
borderStyle : "solid" ,
borderColor : theme . palette . border . light ,
},
},
{
props : ( props ) => props . variant === "group" && props . filled === "true" ,
style : {
backgroundColor : theme . palette . secondary . main ,
},
},
{
props : ( props ) =>
props . variant === "contained" && props . color === "secondary" ,
style : {
border : 1 ,
borderStyle : "solid" ,
borderColor : theme . palette . border . light ,
},
},
2024-11-12 19:10:48 -05:00
{
props : ( props ) => props . variant === "contained" && props . disabled ,
style : {
backgroundColor : ` ${ theme . palette . secondary . main } !important` ,
color : ` ${ theme . palette . secondary . contrastText } !important` ,
},
},
2024-11-09 08:01:14 -05:00
],
fontWeight : 400 ,
borderRadius : 4 ,
boxShadow : "none" ,
textTransform : "none" ,
"&:focus" : {
outline : "none" ,
},
"&:hover" : {
boxShadow : "none" ,
},
}),
},
},
MuiIconButton : {
styleOverrides : {
2024-11-12 17:24:21 -05:00
root : ({ theme }) => ({
2024-11-09 08:01:14 -05:00
padding : 4 ,
transition : "none" ,
"&:hover" : {
2024-11-12 17:24:21 -05:00
backgroundColor : theme . palette . background . fill ,
2024-11-09 08:01:14 -05:00
},
2024-11-12 17:24:21 -05:00
}),
2024-11-09 08:01:14 -05:00
},
},
MuiPaper : {
styleOverrides : {
2024-11-12 17:24:21 -05:00
root : ({ theme }) => {
return {
marginTop : 4 ,
padding : 0 ,
border : 1 ,
borderStyle : "solid" ,
borderColor : theme . palette . border . light ,
borderRadius : 4 ,
boxShadow : shadow ,
backgroundColor : theme . palette . background . main ,
backgroundImage : "none" ,
};
2024-11-09 08:01:14 -05:00
},
},
},
MuiList : {
styleOverrides : {
root : {
padding : 0 ,
},
},
},
MuiListItemButton : {
styleOverrides : {
root : {
transition : "none" ,
},
},
},
MuiMenuItem : {
styleOverrides : {
2024-11-12 17:24:21 -05:00
root : ({ theme }) => ({
2024-11-09 08:01:14 -05:00
borderRadius : 4 ,
backgroundColor : "inherit" ,
padding : "4px 6px" ,
2024-11-12 17:24:21 -05:00
color : theme . palette . text . secondary ,
2024-11-09 08:01:14 -05:00
fontSize : 13 ,
margin : 2 ,
minWidth : 100 ,
"&:hover, &.Mui-selected, &.Mui-selected:hover, &.Mui-selected.Mui-focusVisible" :
{
2024-11-12 17:24:21 -05:00
backgroundColor : theme . palette . background . fill ,
2024-11-09 08:01:14 -05:00
},
2024-11-12 17:24:21 -05:00
}),
2024-11-09 08:01:14 -05:00
},
},
MuiTableCell : {
styleOverrides : {
2024-11-12 17:24:21 -05:00
root : ({ theme }) => ({
borderBottomColor : theme . palette . border . light ,
}),
2024-11-09 08:01:14 -05:00
},
},
MuiTableHead : {
styleOverrides : {
2024-11-12 17:24:21 -05:00
root : ({ theme }) => ({
backgroundColor : theme . palette . background . accent ,
}),
2024-11-09 08:01:14 -05:00
},
},
MuiPagination : {
styleOverrides : {
2024-11-12 17:24:21 -05:00
root : ({ theme }) => ({
backgroundColor : theme . palette . background . main ,
2024-11-09 08:01:14 -05:00
border : 1 ,
borderStyle : "solid" ,
2024-11-12 17:24:21 -05:00
borderColor : theme . palette . border . light ,
2024-11-09 08:01:14 -05:00
"& button" : {
2024-11-12 17:24:21 -05:00
color : theme . palette . text . tertiary ,
2024-11-09 08:01:14 -05:00
borderRadius : 4 ,
},
"& li:first-of-type button, & li:last-of-type button" : {
border : 1 ,
borderStyle : "solid" ,
2024-11-12 17:24:21 -05:00
borderColor : theme . palette . border . light ,
2024-11-09 08:01:14 -05:00
},
2024-11-12 17:24:21 -05:00
}),
2024-11-09 08:01:14 -05:00
},
},
MuiPaginationItem : {
styleOverrides : {
2024-11-12 17:24:21 -05:00
root : ({ theme }) => ({
2024-11-09 08:01:14 -05:00
"&:not(.MuiPaginationItem-ellipsis):hover, &.Mui-selected" : {
2024-11-12 17:24:21 -05:00
backgroundColor : theme . palette . background . fill ,
2024-11-09 08:01:14 -05:00
},
2024-11-12 17:24:21 -05:00
}),
2024-11-09 08:01:14 -05:00
},
},
MuiSkeleton : {
styleOverrides : {
root : ({ theme }) => ({
backgroundColor : theme . palette . unresolved . bg ,
}),
},
},
2024-11-21 15:54:02 +08:00
MuiTextField : {
styleOverrides : {
root : ({ theme }) => ({
"& fieldset" : {
borderColor : theme . palette . border . dark ,
borderRadius : theme . shape . borderRadius ,
},
"& .MuiInputBase-input" : {
2024-11-29 14:06:59 -05:00
padding : ".75em" ,
2024-11-21 15:54:02 +08:00
fontSize : "var(--env-var-font-size-medium)" ,
fontWeight : 400 ,
2024-11-29 10:45:30 -05:00
color : palette . text . secondary ,
2024-11-21 15:54:02 +08:00
},
"& .MuiInputBase-input.MuiOutlinedInput-input" : {
padding : "0 var(--env-var-spacing-1-minus) !important" ,
},
"& .MuiOutlinedInput-root" : {
borderRadius : 4 ,
},
"& .MuiOutlinedInput-notchedOutline" : {
borderRadius : 4 ,
},
2024-11-27 14:50:05 +08:00
2024-11-21 15:54:02 +08:00
"& .MuiFormHelperText-root" : {
color : palette . error . main ,
opacity : 0.8 ,
fontSize : "var(--env-var-font-size-medium)" ,
marginLeft : 0 ,
},
"& .MuiFormHelperText-root.Mui-error" : {
opacity : 0.8 ,
fontSize : "var(--env-var-font-size-medium)" ,
color : palette . error . main ,
},
}),
},
},
2024-11-09 08:01:14 -05:00
},
shape : {
borderRadius : 2 ,
borderThick : 2 ,
boxShadow : shadow ,
},
2024-11-12 19:10:48 -05:00
});
2024-11-08 18:36:43 -05:00
export { baseTheme };