feat: using common baseTheme to avoid repetition

This commit is contained in:
Caio Cabral committed 2024-11-08 18:36:43 -05:00
1 parent 9459416fc5
commit d62f5952d5
10 files changed
+135 -33

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
const typographyLevels = {
xs: ".625rem",
s: ".75rem",
m: ".875rem",
l: "1rem",
xl: "1.5rem",
};
const paletteLight = {
text: {
primary: "#1c2130",
secondary: "#344054",
tertiary: "#475467",
accent: "#838c99",
},
};
export { typographyLevels, paletteLight };
+12 -10
View File
@@ -1,4 +1,5 @@
import { createTheme } from "@mui/material";
import { baseTheme } from "./globalTheme";
const text = {
primary: "#fafafa",
@@ -15,20 +16,21 @@ const background = {
};
const border = { light: "#27272a", dark: "#36363e" };
const fontFamilyDefault =
'"Inter","system-ui", "Avenir", "Helvetica", "Arial", sans-serif';
/* const fontFamilyDefault =
'"Inter","system-ui", "Avenir", "Helvetica", "Arial", sans-serif'; */
const shadow =
"0px 4px 24px -4px rgba(255, 255, 255, 0.03), 0px 3px 3px -3px rgba(255, 255, 255, 0.01)";
const darkTheme = createTheme({
typography: {
fontFamily: fontFamilyDefault,
fontSize: 13,
h1: { fontSize: 22, color: text.primary, fontWeight: 500 },
h2: { fontSize: 14.5, color: text.secondary, fontWeight: 400 },
body1: { fontSize: 13, color: text.tertiary, fontWeight: 400 },
body2: { fontSize: 12, color: text.tertiary, fontWeight: 400 },
},
...baseTheme,
// typography: {
// /* fontFamily: fontFamilyDefault, */
// fontSize: 13,
// h1: { fontSize: 22, color: text.primary, fontWeight: 500 },
// h2: { fontSize: 16, color: text.secondary, fontWeight: 400 },
// body1: { fontSize: 13, color: text.tertiary, fontWeight: 400 },
// body2: { fontSize: 12, color: text.tertiary, fontWeight: 400 },
// },
chart: {
header: {
fontWeight: 400,
+33
View File
@@ -0,0 +1,33 @@
import { paletteLight, typographyLevels } from "./constants";
const fontFamilyPrimary = '"Inter" , sans-serif';
// const fontFamilySecondary = '"Avenir", sans-serif';
const baseTheme = {
typography: {
fontFamily: fontFamilyPrimary,
fontSize: typographyLevels.m,
h1: {
fontSize: typographyLevels.xl,
color: paletteLight.text.primary,
fontWeight: 500,
},
h2: {
fontSize: typographyLevels.l,
color: paletteLight.text.secondary,
fontWeight: 400,
},
body1: {
fontSize: typographyLevels.m,
color: paletteLight.text.tertiary,
fontWeight: 400,
},
body2: {
fontSize: typographyLevels.s,
color: paletteLight.text.tertiary,
fontWeight: 400,
},
},
};
export { baseTheme };
+18 -12
View File
@@ -1,4 +1,6 @@
import { createTheme } from "@mui/material";
import { typographyLevels } from "./constants";
import { baseTheme } from "./globalTheme";
const text = {
primary: "#1c2130",
@@ -15,30 +17,34 @@ const background = {
const border = { light: "#eaecf0", dark: "#d0d5dd" };
const fontFamilyDefault =
'"Inter","system-ui", "Avenir", "Helvetica", "Arial", sans-serif';
/* TODO stop using mui for fonts. Create text component based on emotion */
/* const fontFamilyDefault =
'"Inter","system-ui", "Avenir", "Helvetica", "Arial", sans-serif'; */
const shadow =
"0px 4px 24px -4px rgba(16, 24, 40, 0.08), 0px 3px 3px -3px rgba(16, 24, 40, 0.03)";
const lightTheme = createTheme({
typography: {
fontFamily: fontFamilyDefault,
fontSize: 13,
h1: { fontSize: 22, color: text.primary, fontWeight: 500 },
h2: { fontSize: 14.5, color: text.secondary, fontWeight: 400 },
body1: { fontSize: 13, color: text.tertiary, fontWeight: 400 },
body2: { fontSize: 12, color: text.tertiary, fontWeight: 400 },
},
...baseTheme,
// typography: {
// /* fontFamily: fontFamilyDefault, */
// fontSize: typographyLevels.m,
// h1: { fontSize: typographyLevels.xl, color: text.primary, fontWeight: 500 },
// h2: { fontSize: typographyLevels.l, color: text.secondary, fontWeight: 400 },
// body1: { fontSize: typographyLevels.m, color: text.tertiary, fontWeight: 400 },
// body2: { fontSize: typographyLevels.s, color: text.tertiary, fontWeight: 400 },
// },
chart: {
header: {
fontWeight: 400,
fill: text.tertiary,
fontSize: 11,
fontSize: typographyLevels.m,
},
subheader: {
fontWeight: 400,
fill: text.tertiary,
fontSize: 9,
fontSize: typographyLevels.xs,
},
},
palette: {