UNPKG

@airplane/views

Version:

A React library for building Airplane views. Views components are optimized in style and functionality to produce internal apps that are easy to build and maintain.

58 lines (57 loc) 1.41 kB
import { createStyles } from "@mantine/core"; const useStyles = createStyles((theme, params) => { return { root: { ...getVariantStyles(theme, params), ...getColorStyles(theme, params) } }; }); const getVariantStyles = (theme, params) => { let backgroundColor; let color; let borderColor; if (params.variant === "light") { backgroundColor = theme.colors[params.color][0]; color = theme.colors[params.color][6]; borderColor = backgroundColor; } else if (params.variant === "filled") { backgroundColor = theme.colors[params.color][6]; color = theme.colors[params.color][0]; borderColor = backgroundColor; } else { backgroundColor = theme.white; color = theme.colors[params.color][6]; borderColor = color; } return { backgroundColor, color, border: `1px solid ${borderColor}` }; }; const getColorStyles = (theme, params) => { let fontSize; let padding; if (params.size === "sm") { fontSize = theme.fontSizes.xs; padding = "2px 8px"; } else if (params.size === "md") { fontSize = theme.fontSizes.sm; padding = "4px 14px"; } else { fontSize = theme.fontSizes.md; padding = "4px 16px"; } return { fontFamily: theme.fontFamily, fontWeight: 500, fontSize, borderRadius: theme.radius.xl, padding }; }; export { useStyles }; //# sourceMappingURL=Chip.styles.js.map