@selfcommunity/react-theme-default
Version:
Default theme to use with SelfCommunity TS library
38 lines (37 loc) • 2.42 kB
JavaScript
import { alpha } from '@mui/system';
import { getContrastRatio } from '@mui/material';
const Component = {
styleOverrides: {
root: ({ theme }) => {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
return ({
'& .SCSearchAutocomplete-input': {
padding: theme.spacing(0, 2),
borderRadius: theme.shape.borderRadius,
'& .MuiAutocomplete-input': {
padding: theme.spacing(0.5, 1),
color: getContrastRatio((_b = (_a = theme.palette) === null || _a === void 0 ? void 0 : _a.navbar) === null || _b === void 0 ? void 0 : _b.main, '#fff') > 4.5 ? '#fff' : theme.palette.primary.main
}
},
'& .MuiInputBase-root': {
'& .MuiIcon-root': {
color: getContrastRatio((_d = (_c = theme.palette) === null || _c === void 0 ? void 0 : _c.navbar) === null || _d === void 0 ? void 0 : _d.main, '#fff') > 4.5 ? '#fff' : theme.palette.primary.main
},
'& fieldset': {
borderColor: alpha(getContrastRatio((_f = (_e = theme.palette) === null || _e === void 0 ? void 0 : _e.navbar) === null || _f === void 0 ? void 0 : _f.main, '#fff') > 4.5 ? '#fff' : theme.palette.primary.main, theme.palette.action.disabledOpacity)
},
'&:hover fieldset': {
borderColor: getContrastRatio((_h = (_g = theme.palette) === null || _g === void 0 ? void 0 : _g.navbar) === null || _h === void 0 ? void 0 : _h.main, '#fff') > 4.5 ? '#fff' : theme.palette.primary.main
},
'&.Mui-focused fieldset': {
borderColor: getContrastRatio((_k = (_j = theme.palette) === null || _j === void 0 ? void 0 : _j.navbar) === null || _k === void 0 ? void 0 : _k.main, '#fff') > 4.5 ? '#fff' : theme.palette.secondary.main
},
'&.Mui-focused .SCSearchAutocomplete-icon': {
color: getContrastRatio((_m = (_l = theme.palette) === null || _l === void 0 ? void 0 : _l.navbar) === null || _m === void 0 ? void 0 : _m.main, '#fff') > 4.5 ? '#fff' : theme.palette.secondary.main
}
}
});
}
}
};
export default Component;