feat: passing ppalette to global theme, and starting color cleanup

This commit is contained in:
Caio Cabral committed 2024-11-12 19:10:48 -05:00
1 parent 841bf7b5ed
commit 2969ca3e35
5 files changed
+46 -47

No files matched your search

+1 -1
View File
@@ -25,7 +25,7 @@ const StatusBox = ({ title, value }) => {
</Box> </Box>
); );
} else if (title === "down") { } else if (title === "down") {
color = theme.palette.error.contrastText; color = theme.palette.error.main;
icon = ( icon = (
<Box sx={{ ...sharedStyles, transform: "rotate(180deg)", top: 5 }}> <Box sx={{ ...sharedStyles, transform: "rotate(180deg)", top: 5 }}>
<Arrow /> <Arrow />
+14 -26
View File
@@ -8,18 +8,6 @@ const typographyLevels = {
xl: `${(typographyBase + 10) / 16}rem`, xl: `${(typographyBase + 10) / 16}rem`,
}; };
/* This should not be here. Incorporate into color structure.
Is is being exported to globalStyle*/
const paletteLight = {
text: {
primary: "#1c2130",
secondary: "#344054",
tertiary: "#475467",
accent: "#838c99",
},
};
/* TODO Expand this */ /* TODO Expand this */
const paletteColors = { const paletteColors = {
white: "#FFFFFF", white: "#FFFFFF",
@@ -28,26 +16,26 @@ const paletteColors = {
gray70: "#FDFDFD", gray70: "#FDFDFD",
gray80: "#FDFCFD", gray80: "#FDFCFD",
gray90: "#FCFCFD", gray90: "#FCFCFD",
gray95: "#FAFAFA", /* gray95: "#FAFAFA",
gray97: "#F9FAFB", gray97: "#F9FAFB", */
gray100: "#F4F4F4", gray100: "#F4F4F4",
gray125: "#F2F4F7", /* gray125: "#F2F4F7",
gray150: "#EAECF0", gray150: "#EAECF0",
gray180: "#E6E6E6", gray180: "#E6E6E6", */
gray200: "#E3E3E3", gray200: "#E3E3E3",
gray225: "#D6D9DD", /* gray225: "#D6D9DD",
gray250: "#D0D5DD", gray250: "#D0D5DD", */
gray300: "#A2A3A3", gray300: "#A2A3A3",
gray350: "#A1A1AA", /* gray350: "#A1A1AA",
gray450: "#8E8E8F", gray450: "#8E8E8F", */
gray500: "#838C99", gray500: "#838C99",
gray600: "#454546", gray600: "#454546",
gray750: "#36363E", gray750: "#36363E",
gray800: "#2D2D33", gray800: "#2D2D33",
gray815: "#27272A", /* gray815: "#27272A",
gray830: "#262115", gray830: "#262115",
gray835: "#18181a", gray835: "#18181a",
gray840: "#151518", gray840: "#151518", */
gray850: "#131315", gray850: "#131315",
gray860: "#111113", gray860: "#111113",
gray870: "#0F0F11", gray870: "#0F0F11",
@@ -137,7 +125,7 @@ const semanticColors = {
}, },
contrastText: { contrastText: {
//TODO contrasttext semantically should be something that contrasts with the main //TODO contrasttext semantically should be something that contrasts with the main
light: paletteColors.red200, light: paletteColors.gray50,
dark: paletteColors.red50, dark: paletteColors.red50,
}, },
light: { light: {
@@ -204,14 +192,14 @@ const semanticColors = {
dark: paletteColors.gray800, dark: paletteColors.gray800,
}, },
accent: { accent: {
light: paletteColors.gray97, light: paletteColors.gray100,
dark: paletteColors.gray835, dark: paletteColors.gray835,
}, },
}, },
text: { text: {
primary: { primary: {
light: paletteColors.blueGray900, light: paletteColors.blueGray900,
dark: paletteColors.gray95, dark: paletteColors.gray100,
}, },
secondary: { secondary: {
light: paletteColors.blueGray400, light: paletteColors.blueGray400,
@@ -271,4 +259,4 @@ const semanticColors = {
}, },
}, },
}; };
export { typographyLevels, paletteLight, semanticColors as colors }; export { typographyLevels, semanticColors as colors };
+6 -4
View File
@@ -22,9 +22,7 @@ const {
other, other,
} = colors; } = colors;
const darkTheme = createTheme({ const palette = {
...baseTheme,
palette: {
primary: { main: primary.main.dark }, primary: { main: primary.main.dark },
secondary: { main: secondary.main.dark }, secondary: { main: secondary.main.dark },
success: { success: {
@@ -95,7 +93,11 @@ const darkTheme = createTheme({
light: background.main.dark, light: background.main.dark,
border: border.light.dark, border: border.light.dark,
}, },
}, };
const darkTheme = createTheme({
palette,
...baseTheme(palette),
}); });
export default darkTheme; export default darkTheme;
+17 -9
View File
@@ -1,4 +1,4 @@
import { paletteLight, typographyLevels } from "./constants"; import { typographyLevels } from "./constants";
const fontFamilyPrimary = '"Inter" , sans-serif'; const fontFamilyPrimary = '"Inter" , sans-serif';
// const fontFamilySecondary = '"Avenir", sans-serif'; // const fontFamilySecondary = '"Avenir", sans-serif';
@@ -7,28 +7,28 @@ const fontFamilyPrimary = '"Inter" , sans-serif';
const shadow = const shadow =
"0px 4px 24px -4px rgba(16, 24, 40, 0.08), 0px 3px 3px -3px rgba(16, 24, 40, 0.03)"; "0px 4px 24px -4px rgba(16, 24, 40, 0.08), 0px 3px 3px -3px rgba(16, 24, 40, 0.03)";
const baseTheme = { const baseTheme = (palette) => ({
typography: { typography: {
fontFamily: fontFamilyPrimary, fontFamily: fontFamilyPrimary,
fontSize: 14, fontSize: 14,
h1: { h1: {
fontSize: typographyLevels.xl, fontSize: typographyLevels.xl,
color: paletteLight.text.primary, color: palette.text.primary,
fontWeight: 500, fontWeight: 500,
}, },
h2: { h2: {
fontSize: typographyLevels.l, fontSize: typographyLevels.l,
color: paletteLight.text.secondary, color: palette.text.secondary,
fontWeight: 400, fontWeight: 400,
}, },
body1: { body1: {
fontSize: typographyLevels.m, fontSize: typographyLevels.m,
color: paletteLight.text.tertiary, color: palette.text.tertiary,
fontWeight: 400, fontWeight: 400,
}, },
body2: { body2: {
fontSize: typographyLevels.s, fontSize: typographyLevels.s,
color: paletteLight.text.tertiary, color: palette.text.tertiary,
fontWeight: 400, fontWeight: 400,
}, },
}, },
@@ -36,16 +36,17 @@ const baseTheme = {
chart: { chart: {
header: { header: {
fontWeight: 400, fontWeight: 400,
fill: paletteLight.text.tertiary, fill: palette.text.tertiary,
fontSize: typographyLevels.m, fontSize: typographyLevels.m,
}, },
subheader: { subheader: {
fontWeight: 400, fontWeight: 400,
fill: paletteLight.text.tertiary, fill: palette.text.tertiary,
fontSize: typographyLevels.xs, fontSize: typographyLevels.xs,
}, },
}, },
spacing: 2, spacing: 2,
/* TODO All these should live inside of a component*/
components: { components: {
MuiButton: { MuiButton: {
defaultProps: { defaultProps: {
@@ -79,6 +80,13 @@ const baseTheme = {
borderColor: theme.palette.border.light, borderColor: theme.palette.border.light,
}, },
}, },
{
props: (props) => props.variant === "contained" && props.disabled,
style: {
backgroundColor: `${theme.palette.secondary.main} !important`,
color: `${theme.palette.secondary.contrastText} !important`,
},
},
], ],
fontWeight: 400, fontWeight: 400,
borderRadius: 4, borderRadius: 4,
@@ -207,6 +215,6 @@ const baseTheme = {
borderThick: 2, borderThick: 2,
boxShadow: shadow, boxShadow: shadow,
}, },
}; });
export { baseTheme }; export { baseTheme };
+8 -7
View File
@@ -3,12 +3,11 @@ import { baseTheme } from "./globalTheme";
import { colors } from "./constants"; import { colors } from "./constants";
/* /*
Take things from global theme
Next step: check if all here are being used. Next step: check if all here are being used.
Discuss colors with Gorkem and rest of the team Check for Hex in code base
Check for px in codebase
*/ */
const { const {
@@ -31,9 +30,7 @@ const {
other, other,
} = colors; } = colors;
const lightTheme = createTheme({ const palette = {
...baseTheme,
palette: {
primary: { main: primary.main.light }, primary: { main: primary.main.light },
secondary: { secondary: {
main: secondary.main.light, main: secondary.main.light,
@@ -108,7 +105,11 @@ const lightTheme = createTheme({
light: background.main.light, light: background.main.light,
border: border.dark.light, border: border.dark.light,
}, },
}, };
const lightTheme = createTheme({
palette,
...baseTheme(palette),
}); });
export default lightTheme; export default lightTheme;