theme.ts 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. import { PaletteMode } from '@mui/material';
  2. // define types for the common theme
  3. declare module '@mui/material/styles/createPalette' {
  4. interface Palette {
  5. attuGrey: Palette['primary'];
  6. attuDark: Palette['primary'];
  7. }
  8. interface PaletteOptions {
  9. attuGrey: PaletteOptions['primary'];
  10. attuDark: PaletteOptions['primary'];
  11. }
  12. }
  13. const getCommonThemes = (mode: PaletteMode) => ({
  14. typography: {
  15. fontFamily: [
  16. 'Inter',
  17. '-apple-system',
  18. 'BlinkMacSystemFont',
  19. '"Segoe UI"',
  20. '"Helvetica Neue"',
  21. 'Arial',
  22. 'sans-serif',
  23. '"Apple Color Emoji"',
  24. '"Segoe UI Emoji"',
  25. '"Segoe UI Symbol"',
  26. ].join(','),
  27. },
  28. palette: {
  29. mode,
  30. primary: {
  31. main: '#0ACE82',
  32. light: mode === 'light' ? '#65BA74' : '#4caf9f',
  33. dark: mode === 'light' ? '#08a568' : '#078b63',
  34. },
  35. secondary: {
  36. light: '#82d3ba',
  37. main: '#0ACE82',
  38. dark: '#279371',
  39. },
  40. error: {
  41. main: '#ff4605',
  42. light: mode === 'light' ? '#ff8f68' : '#ff6a3a',
  43. dark: mode === 'light' ? '#cd3804' : '#b33900',
  44. },
  45. attuGrey: {
  46. main: mode === 'light' ? '#aeaebb' : '#565665',
  47. light: mode === 'light' ? '#dcdce3' : '#838394',
  48. dark: mode === 'light' ? '#82838e' : '#34343f',
  49. contrastText: mode === 'light' ? '#f8f8fc' : '#e0e0e5',
  50. },
  51. attuDark: {
  52. main: mode === 'light' ? '#010e29' : '#0d1b34',
  53. },
  54. background: {
  55. default: mode === 'light' ? '#f5f5f5' : '#121212',
  56. paper: mode === 'light' ? '#ffffff' : '#1e1e1e',
  57. },
  58. },
  59. spacing: (factor: number) => `${8 * factor}px`,
  60. });
  61. export const getAttuTheme = (mode: PaletteMode) => {
  62. const commonThemes = getCommonThemes(mode);
  63. return {
  64. ...commonThemes,
  65. components: {
  66. MuiTypography: {
  67. styleOverrides: {
  68. button: {
  69. textTransform: 'initial',
  70. lineHeight: '16px',
  71. fontWeight: 'bold',
  72. variants: [],
  73. },
  74. h1: {
  75. fontSize: '36px',
  76. lineHeight: '42px',
  77. fontWeight: 'bold',
  78. letterSpacing: '-0.02em',
  79. },
  80. h2: {
  81. lineHeight: '24px',
  82. fontSize: '28px',
  83. fontWeight: 'bold',
  84. },
  85. h3: {
  86. lineHeight: '20px',
  87. fontSize: '24px',
  88. fontWeight: 'bold',
  89. },
  90. h4: {
  91. fontWeight: 500,
  92. lineHeight: '23px',
  93. fontSize: '20px',
  94. letterSpacing: '-0.02em',
  95. },
  96. h5: {
  97. fontWeight: 'bold',
  98. fontSize: '16px',
  99. lineHeight: '24px',
  100. },
  101. h6: {
  102. fontWeight: 'normal',
  103. fontSize: '16px',
  104. lineHeight: '24px',
  105. letterSpacing: '-0.01em',
  106. },
  107. body1: {
  108. fontSize: '14px',
  109. lineHeight: 1.5,
  110. },
  111. body2: {
  112. fontSize: '12px',
  113. lineHeight: '16px',
  114. },
  115. caption: {
  116. fontSize: '10px',
  117. lineHeight: '12px',
  118. },
  119. },
  120. },
  121. MuiButton: {
  122. styleOverrides: {
  123. root: {
  124. textTransform: 'initial',
  125. fontWeight: 'bold',
  126. variants: [],
  127. },
  128. text: {
  129. '&:hover': {
  130. backgroundColor: commonThemes.palette.primary.light,
  131. },
  132. },
  133. },
  134. },
  135. MuiDialog: {
  136. styleOverrides: {
  137. paper: {
  138. borderRadius: 8,
  139. },
  140. },
  141. },
  142. MuiDialogActions: {
  143. styleOverrides: {
  144. spacing: {
  145. padding: commonThemes.spacing(4),
  146. },
  147. },
  148. },
  149. MuiDialogContent: {
  150. styleOverrides: {
  151. root: {
  152. padding: `${commonThemes.spacing(1)} ${commonThemes.spacing(4)}`,
  153. },
  154. },
  155. },
  156. MuiDialogTitle: {
  157. styleOverrides: {
  158. root: {
  159. padding: commonThemes.spacing(4),
  160. paddingBottom: commonThemes.spacing(1),
  161. },
  162. },
  163. },
  164. MuiFormHelperText: {
  165. styleOverrides: {
  166. contained: {
  167. marginLeft: 0,
  168. },
  169. },
  170. },
  171. MuiTextField: {
  172. styleOverrides: {},
  173. },
  174. MuiFilledInput: {
  175. styleOverrides: {
  176. underline: {
  177. '&:before': {
  178. borderBottom: 'none',
  179. },
  180. borderWidth: 1,
  181. borderColor: 'transparent',
  182. },
  183. },
  184. },
  185. MuiInput: {
  186. styleOverrides: {
  187. underline: {
  188. '&:hover:not(.Mui-disabled):before': {
  189. borderWidth: 1,
  190. },
  191. borderWidth: 1,
  192. borderColor: 'transparent',
  193. },
  194. },
  195. },
  196. },
  197. };
  198. };
  199. export default getAttuTheme;