ThemeSpring.tsx 832 B

1234567891011121314151617181920212223242526272829303132
  1. import Image from 'next/image';
  2. import { Themes } from '~/stores/use-next-themes';
  3. import { ThemeInjector } from './utils/ThemeInjector';
  4. // import styles from './ThemeSpring.module.scss';
  5. export const getBackgroundImageSrc = (colorScheme: Themes): string => {
  6. switch (colorScheme) {
  7. default:
  8. return '/images/themes/spring/spring02.svg';
  9. }
  10. };
  11. type Props = {
  12. children: JSX.Element,
  13. colorScheme?: Themes,
  14. }
  15. const ThemeSpring = ({ children, colorScheme }: Props): JSX.Element => {
  16. const bgImageNode = (
  17. <>
  18. {colorScheme != null && (
  19. <Image alt='background image' src={getBackgroundImageSrc(colorScheme)} layout='fill' quality="100" />
  20. )}
  21. </>
  22. );
  23. return <ThemeInjector className="theme-spring" bgImageNode={bgImageNode}>{children}</ThemeInjector>;
  24. };
  25. export default ThemeSpring;