11import React from 'react' ;
22import Link from 'next/link' ;
33import type { Meta , StoryFn } from '@storybook/react' ;
4- import { CalendarIcon , Sidebar , type SidebarProps } from '@var-ui/core' ;
4+ import { CalendarIcon , Layout , Sidebar } from '@var-ui/core' ;
55import {
66 Award01Icon ,
77 CoinsStacked03Icon ,
@@ -17,9 +17,58 @@ import {
1717
1818const meta : Meta = {
1919 title : 'Components/Layout' ,
20- component : Sidebar ,
20+ component : Layout ,
2121 tags : [ 'autodocs' ] ,
22- argTypes : { } ,
22+ argTypes : {
23+ expandOnHover : {
24+ description : ' Expand sidebar on hover' ,
25+ control : {
26+ type : 'boolean' ,
27+ } ,
28+ } ,
29+ sidebarWidth : {
30+ description : 'Sidebar width' ,
31+ control : {
32+ type : 'number' ,
33+ } ,
34+ } ,
35+ active : {
36+ description : 'Controllable Active item' ,
37+ control : {
38+ type : 'text' ,
39+ } ,
40+ } ,
41+ defaultActive : {
42+ description : 'Uncontrollable Default active item' ,
43+ control : {
44+ type : 'text' ,
45+ } ,
46+ } ,
47+ onActiveChange : {
48+ description : 'Callback when active item changes' ,
49+ control : {
50+ type : 'object' ,
51+ } ,
52+ } ,
53+ open : {
54+ description : 'Controllable Open sidebar' ,
55+ control : {
56+ type : 'text' ,
57+ } ,
58+ } ,
59+ defaultOpen : {
60+ description : 'Uncontrollable Default Open sidebar' ,
61+ control : {
62+ type : 'text' ,
63+ } ,
64+ } ,
65+ onOpenChange : {
66+ description : 'Callback when open sidebar changes' ,
67+ control : {
68+ type : 'object' ,
69+ } ,
70+ } ,
71+ } ,
2372 args : { } ,
2473} ;
2574
@@ -160,54 +209,61 @@ const links = [
160209 } ,
161210] ;
162211
163- const DefaultTemplate : StoryFn < SidebarProps > = ( { ...args } ) => {
212+ const DefaultTemplate : StoryFn < typeof Layout > = ( { ...args } ) => {
164213 return (
165- < div className = "bg-background-secondary relative min-h-[50vh]" >
166- < Sidebar { ...args } >
167- < Sidebar . Head >
168- < Sidebar . Head . Toggle />
214+ < div className = "bg-background-secondary border-border relative min-h-[50vh] border" >
215+ < Layout >
216+ < Sidebar className = "border-border border" { ...args } >
217+ < Sidebar . Head >
218+ < Sidebar . Head . Toggle />
169219
170- < Sidebar . Head . Logo >
171- < Logo />
172- </ Sidebar . Head . Logo >
173- < Sidebar . Head . Title > Excellent in Every Block</ Sidebar . Head . Title >
174- </ Sidebar . Head >
220+ < Sidebar . Head . Logo >
221+ < Logo />
222+ </ Sidebar . Head . Logo >
223+ < Sidebar . Head . Title > Excellent in Every Block</ Sidebar . Head . Title >
224+ </ Sidebar . Head >
225+
226+ < Sidebar . Body >
227+ { links . map ( ( link ) => (
228+ < Sidebar . Body . Section key = { link . title } >
229+ < Sidebar . Body . Title > { link . title } </ Sidebar . Body . Title >
230+ < Sidebar . Body . List >
231+ { link . routes . map ( ( item ) => {
232+ if ( item ?. dropdowns ) {
233+ return (
234+ < Sidebar . Body . List . Dropdown key = { item . label } icon = { item . icon } label = { item . label } >
235+ { item . dropdowns . map ( ( child ) => (
236+ < Link passHref legacyBehavior href = { child . href } key = { child . value } >
237+ < Sidebar . Body . List . Item value = { child . value } key = { child . value } label = { child . label } />
238+ </ Link >
239+ ) ) }
240+ </ Sidebar . Body . List . Dropdown >
241+ ) ;
242+ }
175243
176- < Sidebar . Body >
177- { links . map ( ( link ) => (
178- < Sidebar . Body . Section key = { link . title } >
179- < Sidebar . Body . Title > { link . title } </ Sidebar . Body . Title >
180- < Sidebar . Body . List >
181- { link . routes . map ( ( item ) => {
182- if ( item ?. dropdowns ) {
183244 return (
184- < Sidebar . Body . List . Dropdown key = { item . label } icon = { item . icon } label = { item . label } >
185- { item . dropdowns . map ( ( child ) => (
186- < Link passHref legacyBehavior href = { child . href } key = { child . value } >
187- < Sidebar . Body . List . Item value = { child . value } key = { child . value } label = { child . label } />
188- </ Link >
189- ) ) }
190- </ Sidebar . Body . List . Dropdown >
245+ < Link passHref legacyBehavior href = { item . href } key = { item . value } >
246+ < Sidebar . Body . List . Item
247+ value = { item . value }
248+ key = { item . value }
249+ icon = { item . icon }
250+ label = { item . label }
251+ />
252+ </ Link >
191253 ) ;
192- }
193-
194- return (
195- < Link passHref legacyBehavior href = { item . href } key = { item . value } >
196- < Sidebar . Body . List . Item value = { item . value } key = { item . value } icon = { item . icon } label = { item . label } />
197- </ Link >
198- ) ;
199- } ) }
200- </ Sidebar . Body . List >
201- </ Sidebar . Body . Section >
202- ) ) }
203- </ Sidebar . Body >
254+ } ) }
255+ </ Sidebar . Body . List >
256+ </ Sidebar . Body . Section >
257+ ) ) }
258+ </ Sidebar . Body >
204259
205- < Sidebar . Footer > Footer</ Sidebar . Footer >
206- </ Sidebar >
260+ < Sidebar . Footer > Footer</ Sidebar . Footer >
261+ </ Sidebar >
207262
208- < main className = "ml-20" > Main Page</ main >
263+ < Layout . Content > Main Page</ Layout . Content >
264+ </ Layout >
209265 </ div >
210266 ) ;
211267} ;
212268
213- export const Default : StoryFn < typeof Sidebar > = DefaultTemplate . bind ( { } ) ;
269+ export const Default : StoryFn < typeof Layout > = DefaultTemplate . bind ( { } ) ;
0 commit comments