widgetWrapper.tsx 891 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import {css} from '@emotion/react';
  2. import styled from '@emotion/styled';
  3. import {motion} from 'framer-motion';
  4. import type {Widget} from './types';
  5. const WidgetWrapper = styled(motion.div)<{displayType: Widget['displayType']}>`
  6. position: relative;
  7. touch-action: manipulation;
  8. ${p => {
  9. switch (p.displayType) {
  10. case 'big_number':
  11. return css`
  12. /* 2 cols */
  13. grid-area: span 1 / span 2;
  14. @media (min-width: ${p.theme.breakpoints.small}) {
  15. /* 4 cols */
  16. grid-area: span 1 / span 1;
  17. }
  18. @media (min-width: ${p.theme.breakpoints.xlarge}) {
  19. /* 6 and 8 cols */
  20. grid-area: span 1 / span 2;
  21. }
  22. `;
  23. default:
  24. return css`
  25. /* 2, 4, 6 and 8 cols */
  26. grid-area: span 2 / span 2;
  27. `;
  28. }
  29. }};
  30. `;
  31. export default WidgetWrapper;