@geezee/react-ui
Version:
Modern and minimalist React UI library.
73 lines • 3.26 kB
JavaScript
import { addColorAlpha } from '../utils/color';
export var getSizes = function getSizes(size) {
var sizes = {
mini: {
heightRatio: '1.5',
fontSize: '0.5714rem',
margin: '0 1.1429rem'
},
small: {
heightRatio: '2',
fontSize: '0.8571rem',
margin: '0 1.1429rem'
},
medium: {
heightRatio: '2.5',
fontSize: '1rem',
margin: '0 1.1429rem'
},
large: {
heightRatio: '3',
fontSize: '1.1429rem',
margin: '0 1.1429rem'
}
};
if (!size) return sizes.medium;
return sizes[size];
};
export var getColors = function getColors(theme, color, solid) {
var colors = {
"default": {
color: theme.palette.cNeutral7,
hoverColor: solid ? 'inherit' : theme.palette.cTheme5,
backgroundColor: solid ? theme.palette.cNeutral0 : theme.palette.cNeutral8,
hoverBackgroundColor: solid ? theme.palette.cTheme0 : theme.palette.cNeutral8,
border: solid ? 'transparent' : "".concat(theme.expressiveness.L1, " ").concat(theme.expressiveness.cLineStyle1, " ").concat(theme.palette.cNeutral2),
hoverBorderColor: solid ? 'transparent' : theme.palette.cTheme5
},
primary: {
color: theme.palette.cNeutral7,
hoverColor: solid ? 'inherit' : theme.palette.cTheme5,
backgroundColor: solid ? theme.palette.cTheme0 : theme.palette.cNeutral8,
hoverBackgroundColor: solid ? theme.palette.cTheme1 : theme.palette.cNeutral8,
border: solid ? 'transparent' : "".concat(theme.expressiveness.L1, " ").concat(theme.expressiveness.cLineStyle1, " ").concat(theme.palette.cNeutral2),
hoverBorderColor: solid ? 'transparent' : theme.palette.cTheme5
},
success: {
color: theme.palette.cNeutral7,
hoverColor: 'inherit',
backgroundColor: solid ? theme.palette.successLight : theme.palette.cNeutral8,
hoverBackgroundColor: solid ? theme.palette.success : theme.palette.cNeutral8,
border: solid ? 'transparent' : "".concat(theme.expressiveness.L1, " ").concat(theme.expressiveness.cLineStyle1, " ").concat(theme.palette.successLight),
hoverBorderColor: solid ? 'transparent' : theme.palette.success
},
warning: {
color: theme.palette.cNeutral7,
hoverColor: 'inherit',
backgroundColor: solid ? theme.palette.warningLight : theme.palette.cNeutral8,
hoverBackgroundColor: solid ? theme.palette.warning : theme.palette.cNeutral8,
border: solid ? 'transparent' : "".concat(theme.expressiveness.L1, " ").concat(theme.expressiveness.cLineStyle1, " ").concat(theme.palette.warningLight),
hoverBorderColor: solid ? 'transparent' : theme.palette.warning
},
error: {
color: theme.palette.error,
hoverColor: theme.palette.error,
backgroundColor: solid ? addColorAlpha(theme.palette.errorLight, 0.4) : theme.palette.cNeutral8,
hoverBackgroundColor: solid ? theme.palette.errorLight : theme.palette.cNeutral8,
border: solid ? 'transparent' : "".concat(theme.expressiveness.L1, " ").concat(theme.expressiveness.cLineStyle1, " ").concat(addColorAlpha(theme.palette.error, 0.4)),
hoverBorderColor: solid ? 'transparent' : theme.palette.error
}
};
if (!color) return colors["default"];
return colors[color];
};