feat: updating texts

This commit is contained in:
Caio Cabral committed 2025-01-07 21:27:52 -05:00
1 parent 36bbf5aba0
commit db86753701
54 files changed
+530 -341

No files matched your search

+128 -1
View File
@@ -253,4 +253,131 @@ const semanticColors = {
},
},
};
export { typographyLevels, semanticColors as colors };
const newColors = {
offWhite: "#FEFEFE",
offBlack: "#131315",
gray300: "#E3E3E3",
gray600: "#A2A3A3",
blueGray50: "#E8F0FE",
blueGray500: "#475467",
blueGray600: "#344054",
blueGray800: "#1C2130",
gray200: "#E3E3E3",
gray500: "#A2A3A3",
blueBlueWave: "#1570EF",
green100: "#8CFFCB",
green200: "#4B9B77",
green400: "#079455",
green700: "#19543A",
orange100: "#FFE5CC",
orange400: "#FD8F22",
orange600: "#9B734B",
orange700: "#694016",
red100: "#F9C2C2",
red400: "#D92020",
red600: "#9B4B4B",
red700: "#791515",
};
const newSemanticColors = {
accent: {
main: {
light: newColors.blueBlueWave,
dark: newColors.blueBlueWave,
},
contrastText: {
light: newColors.offWhite,
dark: newColors.offWhite,
},
},
primary: {
main: {
light: newColors.offWhite,
dark: newColors.offBlack,
},
contrastText: {
main: {
light: newColors.blueGray800,
dark: newColors.blueGray50,
},
secondary: {
light: newColors.blueGray600,
dark: newColors.gray300,
},
tertiary: {
light: newColors.blueGray500,
dark: newColors.gray500,
},
},
},
/* For success, warning and error, contrastText works wll with main, and with the theme primary main color. Accent is to be used in graphs */
success: {
main: {
light: newColors.green700,
dark: newColors.green100,
},
contrastText: {
light: newColors.green100,
dark: newColors.green700,
},
accent: {
light: newColors.green400,
dark: newColors.green200,
},
},
error: {
main: {
light: newColors.red700,
dark: newColors.red100,
},
contrastText: {
light: newColors.red100,
dark: newColors.red700,
},
accent: {
light: newColors.red400,
dark: newColors.red600,
},
},
warning: {
main: {
light: newColors.orange700,
dark: newColors.orange100,
},
contrastText: {
light: newColors.orange100,
dark: newColors.orange700,
},
accent: {
light: newColors.orange400,
dark: newColors.orange600,
},
},
gradient: {
color1: {
light: paletteColors.gray90,
dark: paletteColors.gray890,
},
color2: {
light: paletteColors.gray80,
dark: paletteColors.gray880,
},
color3: {
light: paletteColors.gray70,
dark: paletteColors.gray870,
},
color4: {
light: paletteColors.gray60,
dark: paletteColors.gray860,
},
color5: {
light: paletteColors.gray50,
dark: paletteColors.gray850,
},
},
};
/* TODO proximo passo: quebrar o projeto */
export { typographyLevels, semanticColors as colors, newSemanticColors };
+129 -104
View File
@@ -1,111 +1,31 @@
import { createTheme } from "@mui/material";
import { baseTheme } from "./globalTheme";
import { colors } from "./constants";
import { colors, newSemanticColors } from "./constants";
const {
primary,
secondary,
success,
error,
warning,
neutral,
gradient: {
color1: { dark: color1 },
color2: { dark: color2 },
color3: { dark: color3 },
color4: { dark: color4 },
color5: { dark: color5 },
},
background,
text,
border,
unresolved,
other,
} = colors;
function extractThemeColors(themeType, colorObject) {
if (!["light", "dark"].includes(themeType)) {
throw new Error('Invalid theme type. Use "light" or "dark".');
}
const palette = {
action: {
disabled: border.dark.disabled,
},
primary: { main: primary.main.dark },
secondary: {
main: secondary.main.dark,
contrastText: secondary.contrastText.dark,
light: secondary.dark.dark,
dark: secondary.dark.dark,
},
success: {
main: success.main.dark,
contrastText: success.contrastText.dark,
light: success.light.dark,
dark: success.dark.dark,
},
error: {
main: error.main.dark,
contrastText: error.contrastText.dark,
light: error.light.dark,
dark: error.dark.dark,
},
warning: {
main: warning.main.dark,
light: warning.light.dark,
contrastText: warning.contrastText.dark,
dark: warning.dark.dark,
},
neutral: {
contrastText: neutral.contrastText.dark,
},
/* From this part on, try to create semantic structure, not feature based structure */
percentage: {
uptimePoor: error.main.dark,
uptimeFair: warning.contrastText.dark,
uptimeGood: warning.main.dark /* Change for a success color? ?*/,
uptimeExcellent: success.main.dark,
},
unresolved: {
main: unresolved.main.dark,
light: unresolved.light.dark,
bg: unresolved.bg.dark,
},
divider: border.light.dark,
other: {
icon: text.secondary.dark,
line: border.light.dark,
fill: background.accent.dark,
grid: other.grid.dark,
autofill: secondary.main.dark,
},
gradient: {
color1,
color2,
color3,
color4,
color5,
},
text: {
primary: text.primary.dark,
secondary: text.secondary.dark,
tertiary: text.tertiary.dark,
accent: text.accent.dark,
},
background: {
main: background.main.dark,
alt: background.alt.dark,
fill: background.fill.dark,
accent: background.accent.dark,
},
border: {
light: border.light.dark,
dark: border.dark.dark,
},
info: {
text: text.primary.dark,
main: text.secondary.dark,
bg: background.main.dark,
light: background.main.dark,
border: border.light.dark,
},
};
const extract = (obj) => {
if (typeof obj !== "object" || obj === null) {
return obj;
}
if ("light" in obj && "dark" in obj) {
return obj[themeType]; // Return the value for the specified theme
}
// Reduce the object, keeping only the extracted themeType values
return Object.keys(obj).reduce((acc, key) => {
acc[key] = extract(obj[key]);
return acc;
}, {});
};
return extract(colorObject);
}
const palette = extractThemeColors("dark", newSemanticColors);
const darkTheme = createTheme({
palette,
@@ -113,3 +33,108 @@ const darkTheme = createTheme({
});
export default darkTheme;
// const {
// primary,
// secondary,
// success,
// error,
// warning,
// neutral,
// gradient: {
// color1: { dark: color1 },
// color2: { dark: color2 },
// color3: { dark: color3 },
// color4: { dark: color4 },
// color5: { dark: color5 },
// },
// background,
// text,
// border,
// unresolved,
// other,
// } = colors;
// const palette = {
// action: {
// disabled: border.dark.disabled,
// },
// primary: { main: primary.main.dark },
// secondary: {
// main: secondary.main.dark,
// contrastText: secondary.contrastText.dark,
// light: secondary.dark.dark,
// dark: secondary.dark.dark,
// },
// success: {
// main: success.main.dark,
// contrastText: success.contrastText.dark,
// light: success.light.dark,
// dark: success.dark.dark,
// },
// error: {
// main: error.main.dark,
// contrastText: error.contrastText.dark,
// light: error.light.dark,
// dark: error.dark.dark,
// },
// warning: {
// main: warning.main.dark,
// light: warning.light.dark,
// contrastText: warning.contrastText.dark,
// dark: warning.dark.dark,
// },
// neutral: {
// contrastText: neutral.contrastText.dark,
// },
// /* From this part on, try to create semantic structure, not feature based structure */
// percentage: {
// uptimePoor: error.main.dark,
// uptimeFair: warning.contrastText.dark,
// uptimeGood: warning.main.dark /* Change for a success color? ?*/,
// uptimeExcellent: success.main.dark,
// },
// unresolved: {
// main: unresolved.main.dark,
// light: unresolved.light.dark,
// bg: unresolved.bg.dark,
// },
// divider: border.light.dark,
// other: {
// icon: text.secondary.dark,
// line: border.light.dark,
// fill: background.accent.dark,
// grid: other.grid.dark,
// autofill: secondary.main.dark,
// },
// gradient: {
// color1,
// color2,
// color3,
// color4,
// color5,
// },
// text: {
// primary: text.primary.dark,
// secondary: text.secondary.dark,
// tertiary: text.tertiary.dark,
// accent: text.accent.dark,
// },
// background: {
// main: background.main.dark,
// alt: background.alt.dark,
// fill: background.fill.dark,
// accent: background.accent.dark,
// },
// border: {
// light: border.light.dark,
// dark: border.dark.dark,
// },
// info: {
// text: text.primary.dark,
// main: text.secondary.dark,
// bg: background.main.dark,
// light: background.main.dark,
// border: border.light.dark,
// },
// };
+9 -9
View File
@@ -13,22 +13,22 @@ const baseTheme = (palette) => ({
fontSize: 14,
h1: {
fontSize: typographyLevels.xl,
color: palette.text.primary,
color: palette.primary.contrastText.main,
fontWeight: 500,
},
h2: {
fontSize: typographyLevels.l,
color: palette.text.secondary,
color: palette.primary.contrastText.secondary,
fontWeight: 400,
},
body1: {
fontSize: typographyLevels.m,
color: palette.text.tertiary,
color: palette.primary.contrastText.tertiary,
fontWeight: 400,
},
body2: {
fontSize: typographyLevels.s,
color: palette.text.tertiary,
color: palette.primary.contrastText.tertiary,
fontWeight: 400,
},
},
@@ -97,7 +97,7 @@ const baseTheme = (palette) => ({
"&.MuiLoadingButton-root": {
"&:disabled": {
backgroundColor: theme.palette.secondary.main,
color: theme.palette.text.primary,
color: theme.palette.primary.contrastText.main,
},
},
"&.MuiLoadingButton-loading": {
@@ -160,7 +160,7 @@ const baseTheme = (palette) => ({
borderRadius: 4,
backgroundColor: "inherit",
padding: "4px 6px",
color: theme.palette.text.secondary,
color: theme.palette.primary.contrastText.secondary,
fontSize: 13,
margin: 2,
minWidth: 100,
@@ -193,7 +193,7 @@ const baseTheme = (palette) => ({
borderStyle: "solid",
borderColor: theme.palette.border.light,
"& button": {
color: theme.palette.text.tertiary,
color: theme.palette.primary.contrastText.tertiary,
borderRadius: 4,
},
"& li:first-of-type button, & li:last-of-type button": {
@@ -232,7 +232,7 @@ const baseTheme = (palette) => ({
minHeight: "var(--env-var-height-2)",
fontSize: "var(--env-var-font-size-medium)",
fontWeight: 400,
color: palette.text.secondary,
color: palette.primary.contrastText.secondary,
"&.Mui-disabled": {
opacity: 0.3,
WebkitTextFillColor: "unset",
@@ -241,7 +241,7 @@ const baseTheme = (palette) => ({
"& .MuiInputBase-input:-webkit-autofill": {
transition: "background-color 5000s ease-in-out 0s",
WebkitBoxShadow: `0 0 0px 1000px ${theme.palette.background.main} inset`,
WebkitTextFillColor: theme.palette.text.primary,
WebkitTextFillColor: theme.palette.primary.contrastText.main,
},
"& .MuiInputBase-input.MuiOutlinedInput-input": {
padding: "0 var(--env-var-spacing-1-minus) !important",
+133 -109
View File
@@ -1,118 +1,31 @@
import { createTheme } from "@mui/material";
import { baseTheme } from "./globalTheme";
import { colors } from "./constants";
import { colors, newSemanticColors } from "./constants";
/*
TODO
Next step: check if all keys here are being used in the codebase. e.g.: Search codebase for palette.primary; also check for destructuring palette ('= theme.palette')
*/
function extractThemeColors(themeType, colorObject) {
if (!["light", "dark"].includes(themeType)) {
throw new Error('Invalid theme type. Use "light" or "dark".');
}
const {
primary,
secondary,
success,
error,
warning,
neutral,
gradient: {
color1: { light: color1 },
color2: { light: color2 },
color3: { light: color3 },
color4: { light: color4 },
color5: { light: color5 },
},
background,
text,
border,
unresolved,
other,
} = colors;
const extract = (obj) => {
if (typeof obj !== "object" || obj === null) {
return obj;
}
const palette = {
/* TODO check if we need the addition of a new color gray150 for this. Also, this color would probably fit for primary contrastText */
action: {
disabled: border.light.disabled,
},
primary: { main: primary.main.light },
secondary: {
main: secondary.main.light,
contrastText: secondary.contrastText.light,
light: secondary.dark.light,
dark: secondary.dark.light,
},
success: {
main: success.main.light,
contrastText: success.contrastText.light,
light: success.light.light,
dark: success.dark.light,
},
error: {
main: error.main.light,
contrastText: error.contrastText.light,
light: error.light.light,
dark: error.dark.light,
},
warning: {
main: warning.main.light,
light: warning.light.light,
contrastText: warning.contrastText.light,
dark: warning.dark.light,
},
neutral: {
contrastText: neutral.contrastText.light,
},
/* From this part on, try to create semantic structure, not feature based structure */
percentage: {
uptimePoor: error.main.light,
uptimeFair: warning.contrastText.light,
uptimeGood: warning.main.light /* Change for a success color? */,
uptimeExcellent: success.main.light,
},
unresolved: {
main: unresolved.main.light,
light: unresolved.light.light,
bg: unresolved.bg.light,
},
divider: border.light.light,
other: {
icon: other.icon.light,
line: other.line.light,
fill: secondary.dark.light,
grid: other.grid.light,
autofill: other.autofill.light,
},
gradient: {
color1,
color2,
color3,
color4,
color5,
},
text: {
primary: text.primary.light,
secondary: text.secondary.light,
tertiary: text.tertiary.light,
accent: text.accent.light,
},
background: {
main: background.main.light,
alt: background.alt.light,
fill: background.fill.light,
accent: background.accent.light,
},
border: {
light: border.light.light,
dark: border.dark.light,
},
info: {
text: text.primary.light,
main: text.tertiary.light,
bg: background.main.light,
light: background.main.light,
border: border.dark.light,
},
};
if ("light" in obj && "dark" in obj) {
return obj[themeType]; // Return the value for the specified theme
}
// Reduce the object, keeping only the extracted themeType values
return Object.keys(obj).reduce((acc, key) => {
acc[key] = extract(obj[key]);
return acc;
}, {});
};
return extract(colorObject);
}
const palette = extractThemeColors("light", newSemanticColors);
/* TODO I figured out we could have just one theme by passing mode as parameter for theme function. Implement later */
const lightTheme = createTheme({
palette,
@@ -120,3 +33,114 @@ const lightTheme = createTheme({
});
export default lightTheme;
/*
TODO
Next step: check if all keys here are being used in the codebase. e.g.: Search codebase for palette.primary; also check for destructuring palette ('= theme.palette')
*/
// const {
// primary,
// secondary,
// success,
// error,
// warning,
// neutral,
// gradient: {
// color1: { light: color1 },
// color2: { light: color2 },
// color3: { light: color3 },
// color4: { light: color4 },
// color5: { light: color5 },
// },
// background,
// text,
// border,
// unresolved,
// other,
// } = colors;
// const palette = {
// /* TODO check if we need the addition of a new color gray150 for this. Also, this color would probably fit for primary contrastText */
// action: {
// disabled: border.light.disabled,
// },
// primary: { main: primary.main.light },
// secondary: {
// main: secondary.main.light,
// contrastText: secondary.contrastText.light,
// light: secondary.dark.light,
// dark: secondary.dark.light,
// },
// success: {
// main: success.main.light,
// contrastText: success.contrastText.light,
// light: success.light.light,
// dark: success.dark.light,
// },
// error: {
// main: error.main.light,
// contrastText: error.contrastText.light,
// light: error.light.light,
// dark: error.dark.light,
// },
// warning: {
// main: warning.main.light,
// light: warning.light.light,
// contrastText: warning.contrastText.light,
// dark: warning.dark.light,
// },
// neutral: {
// contrastText: neutral.contrastText.light,
// },
// /* From this part on, try to create semantic structure, not feature based structure */
// percentage: {
// uptimePoor: error.main.light,
// uptimeFair: warning.contrastText.light,
// uptimeGood: warning.main.light /* Change for a success color? */,
// uptimeExcellent: success.main.light,
// },
// unresolved: {
// main: unresolved.main.light,
// light: unresolved.light.light,
// bg: unresolved.bg.light,
// },
// divider: border.light.light,
// other: {
// icon: other.icon.light,
// line: other.line.light,
// fill: secondary.dark.light,
// grid: other.grid.light,
// autofill: other.autofill.light,
// },
// gradient: {
// color1,
// color2,
// color3,
// color4,
// color5,
// },
// text: {
// primary: text.primary.light,
// secondary: text.secondary.light,
// tertiary: text.tertiary.light,
// accent: text.accent.light,
// },
// background: {
// main: background.main.light,
// alt: background.alt.light,
// fill: background.fill.light,
// accent: background.accent.light,
// },
// border: {
// light: border.light.light,
// dark: border.dark.light,
// },
// info: {
// text: text.primary.light,
// main: text.tertiary.light,
// bg: background.main.light,
// light: background.main.light,
// border: border.dark.light,
// },
// };
+1 -1
View File
@@ -170,7 +170,7 @@ const Greeting = ({ type = "" }) => {
component="span"
fontSize="inherit"
fontWeight="inherit"
color={theme.palette.text.secondary}
color={theme.palette.primary.contrastText.secondary}
>
{firstName} {emoji}
</Typography>