@@ -2,10 +2,11 @@ import type { Preview } from "@storybook/nextjs";
22import "../src/global.css" ;
33import { QueryClient , QueryClientProvider } from "@tanstack/react-query" ;
44import { MoonIcon , SunIcon } from "lucide-react" ;
5- import { Inter as interFont } from "next/font/google" ;
65import { ThemeProvider , useTheme } from "next-themes" ;
6+ import { Inter as interFont } from "next/font/google" ;
77// biome-ignore lint/style/useImportType: <explanation>
8- import React , { useEffect } from "react" ;
8+ import React from "react" ;
9+ import { useEffect } from "react" ;
910import { Toaster } from "sonner" ;
1011import { Button } from "../src/@/components/ui/button" ;
1112
@@ -17,33 +18,45 @@ const fontSans = interFont({
1718} ) ;
1819
1920const customViewports = {
20- sm : {
21- // Larger phones (iphone 15 plus / 15 pro max)
22- name : "iPhone Plus" ,
23- styles : {
24- height : "932px" ,
25- width : "430px" ,
26- } ,
27- } ,
2821 xs : {
2922 // Regular sized phones (iphone 15 / 15 pro)
3023 name : "iPhone" ,
3124 styles : {
32- height : "844px" ,
3325 width : "390px" ,
26+ height : "844px" ,
27+ } ,
28+ } ,
29+ sm : {
30+ // Larger phones (iphone 15 plus / 15 pro max)
31+ name : "iPhone Plus" ,
32+ styles : {
33+ width : "430px" ,
34+ height : "932px" ,
3435 } ,
3536 } ,
3637} ;
3738
3839const preview : Preview = {
40+ parameters : {
41+ viewport : {
42+ viewports : customViewports ,
43+ } ,
44+ controls : {
45+ matchers : {
46+ color : / ( b a c k g r o u n d | c o l o r ) $ / i,
47+ date : / D a t e $ / i,
48+ } ,
49+ } ,
50+ } ,
51+
3952 decorators : [
4053 ( Story ) => {
4154 return (
4255 < ThemeProvider
4356 attribute = "class"
44- defaultTheme = "dark"
4557 disableTransitionOnChange
4658 enableSystem = { false }
59+ defaultTheme = "dark"
4760 >
4861 < StoryLayout >
4962 < Story />
@@ -52,22 +65,13 @@ const preview: Preview = {
5265 ) ;
5366 } ,
5467 ] ,
55- parameters : {
56- controls : {
57- matchers : {
58- color : / ( b a c k g r o u n d | c o l o r ) $ / i,
59- date : / D a t e $ / i,
60- } ,
61- } ,
62- viewport : {
63- viewports : customViewports ,
64- } ,
65- } ,
6668} ;
6769
6870export default preview ;
6971
70- function StoryLayout ( props : { children : React . ReactNode } ) {
72+ function StoryLayout ( props : {
73+ children : React . ReactNode ;
74+ } ) {
7175 const { setTheme, theme } = useTheme ( ) ;
7276
7377 useEffect ( ( ) => {
@@ -79,10 +83,10 @@ function StoryLayout(props: { children: React.ReactNode }) {
7983 < div className = "flex min-h-dvh min-w-0 flex-col bg-background text-foreground" >
8084 < div className = "fixed right-0 bottom-0 z-50 flex justify-end gap-2 p-4" >
8185 < Button
82- className = "h-auto w-auto shrink-0 rounded-full p-2"
8386 onClick = { ( ) => setTheme ( theme === "dark" ? "light" : "dark" ) }
8487 size = "sm"
8588 variant = "outline"
89+ className = "h-auto w-auto shrink-0 rounded-full p-2"
8690 >
8791 { theme === "dark" ? (
8892 < MoonIcon className = "size-4" />
@@ -102,4 +106,4 @@ function StoryLayout(props: { children: React.ReactNode }) {
102106function ToasterSetup ( ) {
103107 const { theme } = useTheme ( ) ;
104108 return < Toaster richColors theme = { theme === "light" ? "light" : "dark" } /> ;
105- }
109+ }
0 commit comments