Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

preview.js 921B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import * as NextImage from 'next/image';
  2. import '../styles/globals.css';
  3. const BREAKPOINTS_INT = {
  4. xs: 375,
  5. sm: 600,
  6. md: 900,
  7. lg: 1200,
  8. xl: 1536,
  9. };
  10. const customViewports = Object.fromEntries(
  11. Object.entries(BREAKPOINTS_INT).map(([key, val], idx) => {
  12. console.log(val);
  13. return [
  14. key,
  15. {
  16. name: key,
  17. styles: {
  18. width: `${val}px`,
  19. height: `${(idx + 5) * 10}vh`,
  20. },
  21. },
  22. ];
  23. })
  24. );
  25. // Allow Storybook to handle Next's <Image> component
  26. const OriginalNextImage = NextImage.default;
  27. Object.defineProperty(NextImage, 'default', {
  28. configurable: true,
  29. value: (props) => <OriginalNextImage {...props} unoptimized />,
  30. });
  31. export const parameters = {
  32. actions: { argTypesRegex: '^on[A-Z].*' },
  33. controls: {
  34. matchers: {
  35. color: /(background|color)$/i,
  36. date: /Date$/,
  37. },
  38. },
  39. viewport: { viewports: customViewports },
  40. };