11import type { Meta , StoryObj } from '@storybook/react'
2- import { Header , type HeaderProps } from './Header'
2+ import type { HeaderProps } from '@wayofdev/ui/src'
3+ import { Button , Dropdown , DropdownItemVariant , Header } from '@wayofdev/ui/src'
4+ import Img from './assets/colors.svg'
5+
6+ const triggerContent = (
7+ < >
8+ < div > john.doe@example.com</ div >
9+
10+ < div className = "ml-1" >
11+ < svg className = "h-4 w-4 fill-current" xmlns = "http://www.w3.org/2000/svg" viewBox = "0 0 20 20" >
12+ < path
13+ fillRule = "evenodd"
14+ d = "M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"
15+ clipRule = "evenodd"
16+ />
17+ </ svg >
18+ </ div >
19+ </ >
20+ )
21+
22+ const dropdownItems = [
23+ { variant : DropdownItemVariant . Button , element : 'Settings' , props : { href : '/#Settings' } } ,
24+ { variant : DropdownItemVariant . Button , element : 'My orders' , props : { href : '/#MyOrders' } } ,
25+ { variant : DropdownItemVariant . Button , element : 'Logout' } ,
26+ ]
327
428const meta = {
529 title : 'Example/Header' ,
@@ -10,17 +34,91 @@ const meta = {
1034 // More on how to position stories at: https://storybook.js.org/docs/7.0/react/configure/story-layout
1135 layout : 'fullscreen' ,
1236 } ,
37+ args : {
38+ isAuthenticated : false ,
39+ activePath : '/' ,
40+ navigation : [
41+ { title : 'Home' , href : '/' } ,
42+ { title : 'Products' , href : '/#Products' } ,
43+ ] ,
44+ userNavigation : [
45+ { title : 'Settings' , href : '/#Settings' } ,
46+ { title : 'My orders' , href : '/#MyOrders' } ,
47+ ] ,
48+ logoutConfig : { label : 'Logout' } ,
49+ logo : < img src = { Img } alt = "logo" /> ,
50+ guestBlock : < Button label = "Sign In" /> ,
51+ triggerContent,
52+ authBlock : (
53+ < Dropdown
54+ items = { dropdownItems }
55+ trigger = {
56+ < button className = "flex items-center text-sm font-medium text-gray-500 transition duration-150 ease-in-out hover:text-gray-700 focus:outline-none" >
57+ { triggerContent }
58+ </ button >
59+ }
60+ />
61+ ) ,
62+ userBlock : (
63+ < div className = "flex items-center px-4" >
64+ < div className = "shrink-0" >
65+ < svg
66+ className = "h-12 w-12 fill-current text-gray-400"
67+ xmlns = "http://www.w3.org/2000/svg"
68+ fill = "none"
69+ viewBox = "0 0 24 24"
70+ stroke = "currentColor"
71+ >
72+ < path
73+ strokeLinecap = "round"
74+ strokeLinejoin = "round"
75+ strokeWidth = "2"
76+ d = "M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"
77+ />
78+ </ svg >
79+ </ div >
80+
81+ < div className = "ml-3" >
82+ < div className = "text-base font-medium text-gray-800" > John Doe</ div >
83+ < div className = "text-sm font-medium text-gray-500" > john.doe@example.com</ div >
84+ </ div >
85+ </ div >
86+ ) ,
87+ } ,
1388} satisfies Meta < HeaderProps >
1489
1590export default meta
1691type Story = StoryObj < typeof meta >
1792
93+ export const LoggedOut : Story = { }
94+
1895export const LoggedIn : Story = {
1996 args : {
20- user : {
21- name : 'Jane Doe' ,
22- } ,
97+ isAuthenticated : true ,
98+ triggerContent : undefined ,
99+ authBlock : < Dropdown items = { dropdownItems } /> ,
23100 } ,
24101}
25102
26- export const LoggedOut : Story = { }
103+ export const CustomTriggerMenu : Story = {
104+ args : {
105+ isAuthenticated : true ,
106+ } ,
107+ }
108+
109+ export const CustomHeaderClass : Story = {
110+ args : {
111+ className : 'bg-green-200' ,
112+ } ,
113+ }
114+
115+ export const MobileMenuUserInfo : Story = {
116+ args : {
117+ isAuthenticated : true ,
118+ } ,
119+ parameters : {
120+ viewport : {
121+ defaultViewport : 'iphonexsmax' ,
122+ } ,
123+ } ,
124+ }
0 commit comments