@evenicanpm/ui 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +3 -0
  2. package/package.json +36 -0
  3. package/src/components/button/button.tsx +11 -0
  4. package/src/components/button/index.tsx +1 -0
  5. package/src/components/button/styles/index.ts +11 -0
  6. package/src/components/flex-box/flex-between.tsx +14 -0
  7. package/src/components/flex-box/flex-box.tsx +29 -0
  8. package/src/components/flex-box/flex-row-center.tsx +9 -0
  9. package/src/components/flex-box/index.ts +5 -0
  10. package/src/components/footer/footer.tsx +96 -0
  11. package/src/components/footer/index.ts +1 -0
  12. package/src/components/footer/styles/index.ts +58 -0
  13. package/src/components/header/header.tsx +50 -0
  14. package/src/components/header/index.ts +1 -0
  15. package/src/components/header/styles/index.ts +25 -0
  16. package/src/components/index.ts +12 -0
  17. package/src/components/nav-bar/index.ts +1 -0
  18. package/src/components/nav-bar/nav-bar.tsx +98 -0
  19. package/src/components/nav-bar/nav-item.tsx +72 -0
  20. package/src/components/nav-bar/styles/index.ts +65 -0
  21. package/src/components/responsive-pagination/index.ts +1 -0
  22. package/src/components/responsive-pagination/responsive-pagination.tsx +60 -0
  23. package/src/components/search-input/index.ts +1 -0
  24. package/src/components/search-input/search-input.tsx +28 -0
  25. package/src/components/site-logo/index.tsx +1 -0
  26. package/src/components/site-logo/site-logo.tsx +30 -0
  27. package/src/components/site-logo/styles/index.ts +34 -0
  28. package/src/components/sticky/Sticky.stories.tsx +89 -0
  29. package/src/components/sticky/index.ts +1 -0
  30. package/src/components/sticky/sticky.tsx +67 -0
  31. package/src/components/sticky/styles.ts +38 -0
  32. package/src/components/typography/index.ts +1 -0
  33. package/src/components/typography/typography.tsx +226 -0
  34. package/src/components/user/index.ts +1 -0
  35. package/src/components/user/styles/index.ts +20 -0
  36. package/src/components/user/user.tsx +74 -0
  37. package/src/index.ts +10 -0
  38. package/src/theme/build-mui-theme.ts +146 -0
  39. package/src/theme/components.ts +208 -0
  40. package/src/theme/index.ts +1 -0
  41. package/src/theme/theme-colors.ts +205 -0
  42. package/src/theme/theme-options.ts +113 -0
  43. package/src/theme/theme-provider.tsx +40 -0
  44. package/src/theme/utils.ts +17 -0
  45. package/src/utils/constants.ts +8 -0
  46. package/src/utils/index.ts +1 -0
  47. package/tsconfig.json +19 -0
@@ -0,0 +1,146 @@
1
+ "use client";
2
+ //import type { ThemeItem } from "@evenicanpm/storefront-core/src/api-manager/datasources/e4/graphqlRequestSdk";
3
+ import type { Shadows, ThemeOptions } from "@mui/material";
4
+
5
+ // The file that contains a call to createTheme must have a use client directive
6
+ // https://mui.com/material-ui/integrations/nextjs/
7
+ import { createTheme, type Theme } from "@mui/material/styles";
8
+
9
+ export interface ThemeObject {
10
+ // Breakpoints
11
+ smBreakpoint: number;
12
+ mdBreakpoint: number;
13
+ lgBreakpoint: number;
14
+ xlBreakpoint: number;
15
+
16
+ // Colors
17
+ colorPrimary: string;
18
+ colorSecondary: string;
19
+
20
+ textPrimary: string;
21
+ textSecondary: string;
22
+
23
+ panelBackground?: string;
24
+
25
+ warning: string;
26
+ success: string;
27
+ error: string;
28
+ info: string;
29
+
30
+ // Fonts
31
+ fontFamily: string;
32
+
33
+ h1: number;
34
+ h2: number;
35
+ h3: number;
36
+ h4: number;
37
+ h5: number;
38
+ h6: number;
39
+
40
+ body1: number;
41
+ body2: number;
42
+
43
+ h1Font?: string;
44
+ h5Font?: string;
45
+ h6Font?: string;
46
+ body1Font?: string;
47
+ body2Font?: string;
48
+ }
49
+
50
+ /**
51
+ * Converts database theme object into an MUI theme object to pass to the ThemeProvider
52
+ * @param themeObject is E4 theme entity
53
+ * @returns an MUI theme object
54
+ */
55
+ const themeBuilder = (themeObject: ThemeObject): Theme => {
56
+ const theme = {
57
+ breakpoints: {
58
+ values: {
59
+ xs: 0,
60
+ sm: themeObject.smBreakpoint,
61
+ md: themeObject.mdBreakpoint,
62
+ lg: themeObject.lgBreakpoint,
63
+ xl: themeObject.xlBreakpoint,
64
+ },
65
+ },
66
+ palette: {
67
+ background: {
68
+ default: "#FAFAFA",
69
+ paper: themeObject.panelBackground || "#f6f9fc",
70
+ },
71
+ primary: {
72
+ main: themeObject.colorPrimary,
73
+ contrastText: "#FFF",
74
+ },
75
+ secondary: {
76
+ main: themeObject.colorSecondary,
77
+ },
78
+ text: {
79
+ primary: themeObject.textPrimary,
80
+ secondary: themeObject.textSecondary,
81
+ },
82
+ warning: {
83
+ main: themeObject.warning,
84
+ },
85
+ success: {
86
+ main: themeObject.success,
87
+ },
88
+ error: {
89
+ main: themeObject.error,
90
+ },
91
+ info: {
92
+ main: themeObject.info,
93
+ },
94
+ },
95
+ typography: {
96
+ fontFamily: themeObject.fontFamily,
97
+ h1: {
98
+ fontSize: `${themeObject.h1}rem`,
99
+ fontFamily: themeObject.h1Font || themeObject.fontFamily,
100
+ },
101
+ h2: {
102
+ fontSize: `${themeObject.h2}rem`,
103
+ fontFamily: themeObject.fontFamily,
104
+ },
105
+ h3: {
106
+ fontSize: `${themeObject.h3}rem`,
107
+ fontFamily: themeObject.fontFamily,
108
+ },
109
+ h4: {
110
+ fontSize: `${themeObject.h4}rem`,
111
+ fontFamily: themeObject.fontFamily,
112
+ },
113
+ h5: {
114
+ fontSize: `${themeObject.h5}rem`,
115
+ fontFamily: themeObject.h5Font || themeObject.fontFamily,
116
+ },
117
+ h6: {
118
+ fontSize: `${themeObject.h6}rem`,
119
+ fontFamily: themeObject.h6Font || themeObject.fontFamily,
120
+ },
121
+ body1: {
122
+ fontSize: `${themeObject.body1}rem`,
123
+ fontFamily: themeObject.body1Font || themeObject.fontFamily,
124
+ },
125
+ body2: {
126
+ fontSize: `${themeObject.body2}rem`,
127
+ fontFamily: themeObject.body2Font || themeObject.fontFamily,
128
+ },
129
+ },
130
+ shape: {
131
+ borderRadius: 4,
132
+ },
133
+ shadows: [
134
+ "none",
135
+ "0px 0px 3px rgba(0, 0, 0, 0.09)",
136
+ "0px 35px 60px rgba(0, 0, 0, 0.25)",
137
+ "20px 55px 60px rgba(0, 0, 0, 0.25)",
138
+ "10px 15px 60px rgba(0, 0, 0, 0.25)",
139
+ ...Array(20).fill("none"),
140
+ ] as Shadows,
141
+ };
142
+ const e4Theme = createTheme(theme as ThemeOptions);
143
+ return e4Theme;
144
+ };
145
+
146
+ export default themeBuilder;
@@ -0,0 +1,208 @@
1
+ import type { TypographyOptions } from "@mui/material/styles/createTypography";
2
+ import { dark, grey, primary, secondary, success } from "./theme-colors";
3
+ import { classes } from "./utils";
4
+
5
+ // ========================================================
6
+
7
+ declare module "@mui/material/Button" {
8
+ interface ButtonPropsColorOverrides {
9
+ dark: true;
10
+ paste: true;
11
+ marron: true;
12
+ orange: true;
13
+ }
14
+
15
+ interface ButtonPropsSizeOverrides {
16
+ normal: true;
17
+ }
18
+ }
19
+
20
+ // =========================================================
21
+
22
+ export const components = (typography: TypographyOptions) => ({
23
+ MuiCssBaseline: {
24
+ styleOverrides: {
25
+ "*": {
26
+ margin: 0,
27
+ padding: 0,
28
+ boxSizing: "border-box",
29
+ scrollBehavior: "smooth",
30
+ },
31
+ html: {
32
+ scrollBehavior: "smooth",
33
+ },
34
+ p: {
35
+ lineHeight: 1.75,
36
+ },
37
+ button: {
38
+ fontSize: 14,
39
+ fontFamily: typography.fontFamily,
40
+ },
41
+ ".MuiRating-sizeSmall": {
42
+ fontSize: "20px",
43
+ },
44
+ a: {
45
+ color: "inherit",
46
+ textDecoration: "none",
47
+ },
48
+ ul: {
49
+ margin: 0,
50
+ padding: 0,
51
+ listStyle: "none",
52
+ },
53
+ ".bg-white": {
54
+ backgroundColor: "white",
55
+ },
56
+
57
+ ...classes(),
58
+ },
59
+ },
60
+ MuiInputLabel: {
61
+ styleOverrides: {
62
+ root: { zIndex: 0 },
63
+ },
64
+ },
65
+ MuiDialog: {
66
+ styleOverrides: {
67
+ paper: { borderRadius: 8 },
68
+ },
69
+ },
70
+ MuiCard: {
71
+ styleOverrides: {
72
+ root: { borderRadius: "8px" },
73
+ },
74
+ },
75
+ MuiPagination: {
76
+ defaultProps: {
77
+ variant: "outlined",
78
+ color: "primary",
79
+ },
80
+ },
81
+ MuiMenuItem: {
82
+ styleOverrides: {
83
+ root: { paddingTop: 8, paddingBottom: 8 },
84
+ },
85
+ },
86
+ MuiSvgIcon: {
87
+ styleOverrides: {
88
+ root: {
89
+ "& .secondary": { opacity: 0.4 },
90
+ },
91
+ },
92
+ },
93
+ MuiTextField: {
94
+ defaultProps: { size: "small", variant: "outlined" },
95
+ styleOverrides: {
96
+ //@ts-nocheck
97
+ root: {
98
+ variants: [
99
+ {
100
+ props: { color: "info" },
101
+ style: {
102
+ "& .MuiOutlinedInput-root": {
103
+ borderRadius: "8px",
104
+ fontWeight: 600,
105
+ },
106
+ "& .MuiOutlinedInput-notchedOutline": { borderColor: grey[300] },
107
+ },
108
+ },
109
+ ],
110
+ }, // <-- FIX: Closing brace added here
111
+ }, // <-- FIX: Closing brace added here
112
+ }, // <-- FIX: Closing brace added here
113
+ MuiButton: {
114
+ styleOverrides: {
115
+ root: {
116
+ // Base styles that apply to ALL buttons (moved from the top of the root function)
117
+ minWidth: 0,
118
+ minHeight: 0,
119
+ fontWeight: 600,
120
+ borderRadius: "6px",
121
+ textTransform: "capitalize",
122
+ },
123
+ // The 'sizeLarge' style override can remain as it is not dependent on other props.
124
+ sizeLarge: {
125
+ padding: ".6rem 2.5rem",
126
+ },
127
+ },
128
+ defaultProps: {
129
+ color: "inherit",
130
+ },
131
+ // --- New Variants Array ---
132
+ variants: [
133
+ // 1. ownerState.color === "dark" (Default solid dark button)
134
+ {
135
+ props: { color: "dark", variant: "contained" },
136
+ style: {
137
+ color: "#fff",
138
+ borderRadius: 0,
139
+ transition: "all 0.3s",
140
+ "&:hover": {
141
+ backgroundColor: "#343434",
142
+ },
143
+ },
144
+ },
145
+ // 2. ownerState.color === "dark" && ownerState.variant === "outlined"
146
+ {
147
+ props: { color: "dark", variant: "outlined" },
148
+ style: () => ({
149
+ // Use theme here if needed, or if dark.main is a variable
150
+ color: dark.main,
151
+ borderRadius: "3px",
152
+ transition: "all 0.3s",
153
+ "&:hover": {
154
+ backgroundColor: dark.main,
155
+ color: "white",
156
+ },
157
+ }),
158
+ },
159
+ // 3. ownerState.color === "info" || ownerState.color === "orange"
160
+ {
161
+ props: { color: "info" },
162
+ style: {
163
+ borderRadius: "8px",
164
+ },
165
+ },
166
+ {
167
+ props: { color: "orange" },
168
+ style: {
169
+ borderRadius: "8px",
170
+ },
171
+ },
172
+ // 4. ownerState.color === "orange" || ownerState.color === "success" (Text color white)
173
+ {
174
+ props: { color: "orange" },
175
+ style: {
176
+ color: "white",
177
+ },
178
+ },
179
+ {
180
+ props: { color: "success" },
181
+ style: {
182
+ color: "white",
183
+ },
184
+ },
185
+ ],
186
+ },
187
+
188
+ MuiChip: {
189
+ defaultProps: { color: "primary" },
190
+ styleOverrides: {
191
+ labelSmall: { paddingInline: 12 },
192
+ colorSuccess: { color: success.main, backgroundColor: success[100] },
193
+ colorSecondary: {
194
+ color: secondary[500],
195
+ backgroundColor: secondary[100],
196
+ },
197
+ colorPrimary: {
198
+ color: primary[500],
199
+ backgroundColor: primary[100],
200
+ "&:hover": { color: primary[500], backgroundColor: primary[100] },
201
+ },
202
+ },
203
+ },
204
+
205
+ MuiContainer: {
206
+ defaultProps: { maxWidth: "xl" },
207
+ },
208
+ });
@@ -0,0 +1 @@
1
+ export * from "./theme-provider";
@@ -0,0 +1,205 @@
1
+ // =================================================================
2
+ interface CustomPaletteColor {
3
+ 50: string;
4
+ 100: string;
5
+ 200: string;
6
+ 300: string;
7
+ 400: string;
8
+ 600: string;
9
+ 700: string;
10
+ 800: string;
11
+ 900: string;
12
+ main: string;
13
+ contrastText: string;
14
+ }
15
+
16
+ declare module "@mui/material/styles" {
17
+ interface Palette {
18
+ dark?: CustomPaletteColor;
19
+ paste?: CustomPaletteColor;
20
+ marron?: CustomPaletteColor;
21
+ orange?: CustomPaletteColor;
22
+ bluish?: CustomPaletteColor;
23
+ }
24
+
25
+ interface PaletteOptions {
26
+ gold?: CustomPaletteColor;
27
+ dark?: CustomPaletteColor;
28
+ paste?: CustomPaletteColor;
29
+ marron?: CustomPaletteColor;
30
+ orange?: CustomPaletteColor;
31
+ bluish?: CustomPaletteColor;
32
+ }
33
+ }
34
+ // =================================================================
35
+
36
+ export const grey = {
37
+ 900: "#2B3445", // Main Text
38
+ 800: "#373F50", // Paragraph
39
+ 700: "#4B566B",
40
+ 600: "#7D879C", // Low Priority form Title/Text
41
+ 500: "#AEB4BE",
42
+ 400: "#DAE1E7", // Border
43
+ 300: "#E3E9EF",
44
+ 200: "#F3F5F9", // Line Stroke
45
+ 100: "#FFFFFF",
46
+ };
47
+
48
+ export const primary = {
49
+ 100: "#FCE9EC",
50
+ 200: "#F8C7CF",
51
+ 300: "#F07D90",
52
+ 400: "#EC6178",
53
+ 500: "#D23F57",
54
+ 600: "#E63E58",
55
+ 700: "#E3364E",
56
+ 800: "#DF2E44",
57
+ 900: "#D91F33",
58
+ };
59
+
60
+ export const secondary = {
61
+ 100: "#e8e8ee",
62
+ 200: "#b9bacb",
63
+ 300: "#8a8ca8",
64
+ 400: "#5b5d85",
65
+ 500: "#141850",
66
+ 600: "#0F3460",
67
+ 700: "#101340",
68
+ 800: "#0e1138",
69
+ 900: "#0c0e30",
70
+ main: "#0F3460",
71
+ dark: "#0c0e30",
72
+ };
73
+
74
+ export const error = {
75
+ 100: "#FFEAEA",
76
+ 200: "#FFCBCB",
77
+ 300: "#FFA9A9",
78
+ 400: "#FF6D6D",
79
+ 500: "#FF5353",
80
+ 600: "#FF4C4C",
81
+ 700: "#FF4242",
82
+ 800: "#FF3939",
83
+ 900: "#FF2929",
84
+ main: "#E94560",
85
+ };
86
+
87
+ export const success = {
88
+ 100: "#E7F9ED",
89
+ 200: "#C2F1D1",
90
+ 300: "#99E8B3",
91
+ 400: "#52D77E",
92
+ 500: "#33D067",
93
+ 600: "#2ECB5F",
94
+ 700: "#27C454",
95
+ 800: "#20BE4A",
96
+ 900: "#0b7724",
97
+ main: "rgb(51, 208, 103)",
98
+ };
99
+
100
+ export const blue = {
101
+ 50: "#f3f5f9",
102
+ 100: "#DBF0FE",
103
+ 200: "#B8DEFE",
104
+ 300: "#94C9FE",
105
+ 400: "#7AB6FD",
106
+ 500: "#4E97FD",
107
+ 600: "#3975D9",
108
+ 700: "#2756B6",
109
+ 800: "#183C92",
110
+ 900: "#0E2979",
111
+ main: "#4E97FD",
112
+ contrastText: "#FFFFFF",
113
+ };
114
+
115
+ export const marron = {
116
+ 50: "#f3f5f9",
117
+ 100: "#F6F2ED",
118
+ 200: "#F8DBD1",
119
+ 300: "#EBBCB3",
120
+ 400: "#D89C98",
121
+ 600: "#A3545C",
122
+ 700: "#883948",
123
+ 800: "#6E2438",
124
+ 900: "#5B162F",
125
+ main: "#BE7374",
126
+ };
127
+
128
+ export const paste = {
129
+ 50: "#F5F5F5",
130
+ 100: "#DDFBF1",
131
+ 200: "#BDF7E8",
132
+ 300: "#97E8DA",
133
+ 400: "#76D2CA",
134
+ 600: "#36929A",
135
+ 700: "#257181",
136
+ 800: "#175368",
137
+ 900: "#0E3D56",
138
+ main: "#4BB4B4",
139
+ contrastText: "#FFFFFF",
140
+ };
141
+
142
+ export const orange = {
143
+ 50: "#FEE9D2",
144
+ 100: "#FDD8AF",
145
+ 200: "#FCC487",
146
+ 300: "#FCB05F",
147
+ 400: "#FB9C37",
148
+ 500: "#FA8C16",
149
+ 600: "#C86904",
150
+ 700: "#A05403",
151
+ 800: "#783F03",
152
+ 900: "#502A02",
153
+ main: "#FA8C16",
154
+ dark: "#C86904",
155
+ light: "#FDD8AF",
156
+ };
157
+
158
+ export const bluish = {
159
+ 100: "#DDFBF1",
160
+ 200: "#BDF7E8",
161
+ 300: "#97E8DA",
162
+ 400: "#76D2CA",
163
+ 500: "#4BB4B4",
164
+ 600: "#36929A",
165
+ 700: "#257181",
166
+ 800: "#175368",
167
+ 900: "#0E3D56",
168
+ main: "#4BB4B4",
169
+ dark: "#36929A",
170
+ light: "#BDF7E8",
171
+ };
172
+
173
+ export const warning = {
174
+ 100: "#FFF8E5",
175
+ main: "#FFCD4E",
176
+ dark: "#FA8C16",
177
+ contrastText: "#FFFFFF",
178
+ };
179
+
180
+ export const gold = {
181
+ main: "#BB9C36",
182
+ };
183
+
184
+ export const bluishBackground = "#F6F9FC";
185
+
186
+ export const dark = { main: "#1F2937" };
187
+ export const white = { main: "#fff" };
188
+
189
+ export const themeColors = {
190
+ dark,
191
+ grey,
192
+ gold,
193
+ paste,
194
+ error,
195
+ orange,
196
+ marron,
197
+ bluish,
198
+ warning,
199
+ success,
200
+ secondary,
201
+ info: blue,
202
+ divider: grey[200],
203
+ background: { default: grey[100] },
204
+ text: { primary: grey[900], secondary: grey[800], disabled: grey[400] },
205
+ };
@@ -0,0 +1,113 @@
1
+ import type { TypographyOptions } from "@mui/material/styles/createTypography";
2
+ import { components } from "./components";
3
+ import {
4
+ blue,
5
+ bluish,
6
+ gold,
7
+ marron,
8
+ orange,
9
+ paste,
10
+ primary,
11
+ success,
12
+ themeColors,
13
+ warning,
14
+ } from "./theme-colors";
15
+
16
+ const THEMES = {
17
+ GIFT: "GIFT",
18
+ HEALTH: "HEALTH",
19
+ DEFAULT: "DEFAULT",
20
+ GROCERY: "GROCERY",
21
+ PASTE: "PASTE",
22
+ ORANGE: "ORANGE",
23
+ GOLD: "GOLD",
24
+ BLUISH: "BLUISH",
25
+ GREEN: "GREEN",
26
+ YELLOW: "YELLOW",
27
+ };
28
+
29
+ const breakpoints = {
30
+ values: {
31
+ xs: 0,
32
+ sm: 600,
33
+ md: 960,
34
+ lg: 1280,
35
+ xl: 1600,
36
+ xxl: 1920,
37
+ },
38
+ };
39
+ /*
40
+ WE CREATED MULTIPLE THEME OPTIONS FOR DIFFERENT SHOP VARIATION.
41
+
42
+ YOU CAN JUST KEEP [THEMES.DEFAULT] AND REMOVE OTHER THEME OPTIONS.
43
+ */
44
+ const themesOptionList = (typography: TypographyOptions) => ({
45
+ [THEMES.DEFAULT]: {
46
+ typography,
47
+ components: components(typography),
48
+ breakpoints,
49
+ palette: { primary: { ...primary, light: primary[100] }, ...themeColors },
50
+ },
51
+ [THEMES.GROCERY]: {
52
+ typography,
53
+ components: components(typography),
54
+ breakpoints,
55
+ palette: { primary: { ...primary, light: primary[100] }, ...themeColors },
56
+ },
57
+ [THEMES.PASTE]: {
58
+ typography,
59
+ components: components(typography),
60
+ breakpoints,
61
+ palette: { primary: { ...paste, light: paste[100] }, ...themeColors },
62
+ },
63
+ [THEMES.HEALTH]: {
64
+ typography,
65
+ components: components(typography),
66
+ breakpoints,
67
+ palette: { primary: { ...blue, light: blue[100] }, ...themeColors },
68
+ },
69
+ [THEMES.GIFT]: {
70
+ typography,
71
+ components: components(typography),
72
+ breakpoints,
73
+ palette: { primary: { ...marron, light: marron[100] }, ...themeColors },
74
+ },
75
+ [THEMES.ORANGE]: {
76
+ typography,
77
+ components: components(typography),
78
+ breakpoints,
79
+ palette: { primary: { ...orange }, ...themeColors },
80
+ },
81
+ [THEMES.GOLD]: {
82
+ typography,
83
+ components: components(typography),
84
+ breakpoints,
85
+ palette: { primary: { ...gold }, ...themeColors },
86
+ },
87
+ [THEMES.BLUISH]: {
88
+ typography,
89
+ components: components(typography),
90
+ breakpoints,
91
+ palette: { primary: { ...bluish }, ...themeColors },
92
+ },
93
+ [THEMES.GREEN]: {
94
+ typography,
95
+ components: components(typography),
96
+ breakpoints,
97
+ palette: { primary: { ...success }, ...themeColors },
98
+ },
99
+
100
+ [THEMES.YELLOW]: {
101
+ typography,
102
+ components: components(typography),
103
+ breakpoints,
104
+ palette: { primary: { ...warning }, ...themeColors },
105
+ },
106
+ });
107
+
108
+ const getThemeOptions = (typography: TypographyOptions) => {
109
+ const themeOption = themesOptionList(typography)[THEMES.DEFAULT];
110
+ return themeOption;
111
+ };
112
+
113
+ export default getThemeOptions;
@@ -0,0 +1,40 @@
1
+ "use client";
2
+ import type { ThemeOptions } from "@mui/material";
3
+ import CssBaseline from "@mui/material/CssBaseline";
4
+ import createTheme from "@mui/material/styles/createTheme";
5
+
6
+ import type { TypographyOptions } from "@mui/material/styles/createTypography";
7
+ import responsiveFontSizes from "@mui/material/styles/responsiveFontSizes";
8
+ import MuiThemeProvider from "@mui/material/styles/ThemeProvider";
9
+ import { deepmerge } from "@mui/utils";
10
+ import type { ReactNode } from "react";
11
+ import getThemeOptions from "./theme-options";
12
+
13
+ export const ThemeProvider = ({
14
+ children,
15
+ typography,
16
+ themeOptions,
17
+ }: {
18
+ children: ReactNode;
19
+ themeOptions?: ThemeOptions;
20
+ typography: TypographyOptions;
21
+ }) => {
22
+ const baseTheme = getThemeOptions(typography) as unknown as ThemeOptions;
23
+
24
+ let theme = createTheme(deepmerge(baseTheme, themeOptions));
25
+
26
+ theme = responsiveFontSizes(theme);
27
+
28
+ // theme shadows
29
+ theme.shadows[1] = "0px 1px 3px rgba(3, 0, 71, 0.09)";
30
+ theme.shadows[2] = "0px 4px 16px rgba(43, 52, 69, 0.1)";
31
+ theme.shadows[3] = "0px 8px 45px rgba(3, 0, 71, 0.09)";
32
+ theme.shadows[4] = "0px 0px 28px rgba(3, 0, 71, 0.01)";
33
+
34
+ return (
35
+ <MuiThemeProvider theme={theme}>
36
+ <CssBaseline />
37
+ {children}
38
+ </MuiThemeProvider>
39
+ );
40
+ };