Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

functions.web.ts 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* eslint-disable @typescript-eslint/naming-convention */
  2. import { adaptV4Theme, createTheme } from '@mui/material/styles';
  3. import { ITypography, IPalette as Palette1 } from '../ui/types';
  4. import { createColorTokens } from './utils';
  5. declare module '@mui/material/styles' {
  6. // eslint-disable-next-line @typescript-eslint/no-empty-interface
  7. interface Palette extends Palette1 {}
  8. // eslint-disable-next-line @typescript-eslint/no-empty-interface
  9. interface TypographyVariants extends ITypography {}
  10. }
  11. interface ThemeProps {
  12. breakpoints: Object;
  13. colorMap: Object;
  14. colors: Object;
  15. font: Object;
  16. shape: Object;
  17. spacing: Array<number>;
  18. typography: Object;
  19. }
  20. /**
  21. * Creates a MUI theme based on local UI tokens.
  22. *
  23. * @param {Object} arg - The ui tokens.
  24. * @returns {Object}
  25. */
  26. export function createWebTheme({ font, colors, colorMap, shape, spacing, typography, breakpoints }: ThemeProps) {
  27. return createTheme(adaptV4Theme({
  28. spacing,
  29. palette: createColorTokens(colorMap, colors),
  30. shape,
  31. // @ts-ignore
  32. typography: {
  33. // @ts-ignore
  34. font,
  35. ...typography
  36. },
  37. breakpoints
  38. }));
  39. }