@licklist/design 0.78.19 → 0.78.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.storybook/main.cjs +55 -6
- package/.storybook/preview.jsx +77 -7
- package/dist/Maintenance/Maintenance.scss.js +6 -0
- package/dist/Maintenance/MaintenancePage.d.ts +12 -0
- package/dist/Maintenance/MaintenancePage.d.ts.map +1 -0
- package/dist/Maintenance/MaintenancePage.js +98 -0
- package/dist/Maintenance/SkeletonSidebar.d.ts +5 -0
- package/dist/Maintenance/SkeletonSidebar.d.ts.map +1 -0
- package/dist/Maintenance/SkeletonSidebar.js +101 -0
- package/dist/PageNotFound/PageNotFound.d.ts +10 -0
- package/dist/PageNotFound/PageNotFound.d.ts.map +1 -0
- package/dist/PageNotFound/PageNotFound.js +42 -0
- package/dist/PageNotFound/index.d.ts +2 -0
- package/dist/PageNotFound/index.d.ts.map +1 -0
- package/dist/UnderMaintenance/UnderMaintenance.d.ts +4 -0
- package/dist/UnderMaintenance/UnderMaintenance.d.ts.map +1 -0
- package/dist/UnderMaintenance/UnderMaintenance.js +39 -0
- package/dist/UnderMaintenance/UnderMaintenance.scss.js +6 -0
- package/dist/UnderMaintenance/index.d.ts +2 -0
- package/dist/UnderMaintenance/index.d.ts.map +1 -0
- package/dist/auth/Authorizer.d.ts.map +1 -1
- package/dist/auth/Authorizer.js +4 -3
- package/dist/auth/Layout/UserNavDropDown.js +1 -1
- package/dist/auth/Login/LoginComponent.d.ts.map +1 -1
- package/dist/auth/Login/LoginComponent.js +8 -6
- package/dist/auth/Logout/Logout.js +1 -1
- package/dist/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetModal.js +4 -3
- package/dist/iframe/ProductWithModifierModal/ModifierSetModal/controll/ModifierSetControll.js +2 -1
- package/dist/iframe/ProductWithModifierModal/ModifierSetModal/controll/ProductControll.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/notification/components/NotificationPlaceholders.js +1 -1
- package/dist/product-set/form/ProductCategoriesControl.d.ts.map +1 -1
- package/dist/product-set/form/ProductCategoriesControl.js +13 -5
- package/dist/provider/provider-details-input/ProviderDetailsInput.js +1 -1
- package/dist/recurrence-input/RecurrenceEndInput.d.ts.map +1 -1
- package/dist/recurrence-input/RecurrenceEndInput.js +7 -3
- package/dist/sortable-tree/SortableTree.js +1 -26
- package/dist/styles/overrides/_functions.scss +1 -1
- package/dist/v2/components/Alert/Alert.d.ts +14 -0
- package/dist/v2/components/Alert/Alert.d.ts.map +1 -0
- package/dist/v2/components/Alert/index.d.ts +3 -0
- package/dist/v2/components/Alert/index.d.ts.map +1 -0
- package/dist/v2/components/Button/Button.d.ts +10 -0
- package/dist/v2/components/Button/Button.d.ts.map +1 -0
- package/dist/v2/components/Button/index.d.ts +3 -0
- package/dist/v2/components/Button/index.d.ts.map +1 -0
- package/dist/v2/components/Colors/Colors.d.ts +21 -0
- package/dist/v2/components/Colors/Colors.d.ts.map +1 -0
- package/dist/v2/components/Colors/index.d.ts +3 -0
- package/dist/v2/components/Colors/index.d.ts.map +1 -0
- package/dist/v2/components/Typography/Typography.d.ts +11 -0
- package/dist/v2/components/Typography/Typography.d.ts.map +1 -0
- package/dist/v2/components/Typography/index.d.ts +3 -0
- package/dist/v2/components/Typography/index.d.ts.map +1 -0
- package/dist/v2/hooks/useAuth.d.ts +4 -0
- package/dist/v2/hooks/useAuth.d.ts.map +1 -0
- package/dist/v2/index.d.ts +56 -0
- package/dist/v2/index.d.ts.map +1 -0
- package/dist/v2/navigation/FigmasAdminSideBar/FigmasAdminSideBar.d.ts +8 -0
- package/dist/v2/navigation/FigmasAdminSideBar/FigmasAdminSideBar.d.ts.map +1 -0
- package/dist/v2/navigation/FigmasAdminSideBar/index.d.ts +3 -0
- package/dist/v2/navigation/FigmasAdminSideBar/index.d.ts.map +1 -0
- package/dist/v2/navigation/FigmasSideBar/FigmasSideBar.d.ts +22 -0
- package/dist/v2/navigation/FigmasSideBar/FigmasSideBar.d.ts.map +1 -0
- package/dist/v2/navigation/FigmasSideBar/index.d.ts +3 -0
- package/dist/v2/navigation/FigmasSideBar/index.d.ts.map +1 -0
- package/dist/v2/navigation/FigmasTopHat/FigmasTopHat.d.ts +15 -0
- package/dist/v2/navigation/FigmasTopHat/FigmasTopHat.d.ts.map +1 -0
- package/dist/v2/navigation/FigmasTopHat/index.d.ts +3 -0
- package/dist/v2/navigation/FigmasTopHat/index.d.ts.map +1 -0
- package/dist/v2/navigation/Navigation/Navigation.d.ts +9 -0
- package/dist/v2/navigation/Navigation/Navigation.d.ts.map +1 -0
- package/dist/v2/navigation/Navigation/index.d.ts +3 -0
- package/dist/v2/navigation/Navigation/index.d.ts.map +1 -0
- package/dist/v2/navigation/NavigationItem/NavigationItem.d.ts +12 -0
- package/dist/v2/navigation/NavigationItem/NavigationItem.d.ts.map +1 -0
- package/dist/v2/navigation/NavigationItem/index.d.ts +3 -0
- package/dist/v2/navigation/NavigationItem/index.d.ts.map +1 -0
- package/dist/v2/navigation/NavigationSection/NavigationSection.d.ts +8 -0
- package/dist/v2/navigation/NavigationSection/NavigationSection.d.ts.map +1 -0
- package/dist/v2/navigation/NavigationSection/index.d.ts +3 -0
- package/dist/v2/navigation/NavigationSection/index.d.ts.map +1 -0
- package/dist/v2/navigation/SideBarToggleLarge/SideBarToggleLarge.d.ts +9 -0
- package/dist/v2/navigation/SideBarToggleLarge/SideBarToggleLarge.d.ts.map +1 -0
- package/dist/v2/navigation/SideBarToggleLarge/index.d.ts +3 -0
- package/dist/v2/navigation/SideBarToggleLarge/index.d.ts.map +1 -0
- package/dist/v2/navigation/SidebarUserElement/SidebarUserElement.d.ts +15 -0
- package/dist/v2/navigation/SidebarUserElement/SidebarUserElement.d.ts.map +1 -0
- package/dist/v2/navigation/SidebarUserElement/index.d.ts +3 -0
- package/dist/v2/navigation/SidebarUserElement/index.d.ts.map +1 -0
- package/dist/v2/navigation/SidebarWithAuth.d.ts +20 -0
- package/dist/v2/navigation/SidebarWithAuth.d.ts.map +1 -0
- package/dist/v2/navigation/TopHatControlDisc/TopHatControlDisc.d.ts +9 -0
- package/dist/v2/navigation/TopHatControlDisc/TopHatControlDisc.d.ts.map +1 -0
- package/dist/v2/navigation/TopHatControlDisc/index.d.ts +3 -0
- package/dist/v2/navigation/TopHatControlDisc/index.d.ts.map +1 -0
- package/dist/v2/navigation/config.d.ts +3 -0
- package/dist/v2/navigation/config.d.ts.map +1 -0
- package/dist/v2/navigation/icons/index.d.ts +12 -0
- package/dist/v2/navigation/icons/index.d.ts.map +1 -0
- package/dist/v2/navigation/index.d.ts +23 -0
- package/dist/v2/navigation/index.d.ts.map +1 -0
- package/dist/v2/types/navigation.d.ts +17 -0
- package/dist/v2/types/navigation.d.ts.map +1 -0
- package/package.json +4 -3
- package/rollup.config.js +13 -0
- package/src/Maintenance/Maintenance.scss +253 -0
- package/src/Maintenance/MaintenancePage.tsx +59 -0
- package/src/Maintenance/SkeletonSidebar.tsx +56 -0
- package/src/PageNotFound/PageNotFound.scss +8 -0
- package/src/PageNotFound/PageNotFound.stories.tsx +23 -0
- package/src/PageNotFound/PageNotFound.tsx +43 -0
- package/src/PageNotFound/index.ts +1 -0
- package/src/UnderMaintenance/UnderMaintenance.scss +6 -0
- package/src/UnderMaintenance/UnderMaintenance.stories.tsx +23 -0
- package/src/UnderMaintenance/UnderMaintenance.tsx +22 -0
- package/src/UnderMaintenance/index.ts +1 -0
- package/src/auth/Auth.stories.tsx +37 -3
- package/src/auth/Authorizer.tsx +3 -2
- package/src/auth/ChangePassword/ChangePassword.stories.tsx +1 -8
- package/src/auth/Layout/UserNavDropDown.tsx +1 -1
- package/src/auth/Login/Login.stories.tsx +1 -6
- package/src/auth/Login/LoginComponent.tsx +7 -5
- package/src/auth/Logout/Logout.stories.tsx +3 -0
- package/src/auth/Logout/Logout.tsx +1 -1
- package/src/auth/Register/Register.stories.tsx +3 -7
- package/src/auth/ResetPassword/ResetPassword.stories.tsx +1 -8
- package/src/auth/Social/Social.stories.tsx +1 -6
- package/src/collapsible-input-group/CollapsibleInputGroup.stories.tsx +72 -4
- package/src/events/edit-event-modal/component/EditEventForm/EditEventForm.stories.tsx +2 -1
- package/src/events/edit-recurrent-event-modal/EditRecurrentEventModal.stories.tsx +3 -2
- package/src/events/event-card/EventCard.stories.tsx +3 -2
- package/src/events/event-statistic-modal/EventStatisticModal.stories.tsx +2 -1
- package/src/events/event-venue-map/EventVenueMap.stories.tsx +8 -1
- package/src/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetModal.tsx +3 -3
- package/src/iframe/ProductWithModifierModal/ModifierSetModal/controll/ModifierSetControll.tsx +2 -2
- package/src/iframe/ProductWithModifierModal/ModifierSetModal/controll/ProductControll.tsx +1 -1
- package/src/iframe/custom-fields/components/CustomDateField.stories.tsx +3 -2
- package/src/iframe/event/event-card/IframeEventCard.stories.tsx +7 -5
- package/src/iframe/event/event-card/IframeEventCards.stories.tsx +7 -6
- package/src/iframe/event/event-description/EventDescription.stories.tsx +3 -2
- package/src/iframe/event/event-venue-map/IframeEventVenueMap.stories.tsx +3 -2
- package/src/iframe/external-modal/ExternalModal.stories.tsx +3 -0
- package/src/iframe/order-process/components/CalendarStepsForm/CalendarStepsForm.stories.tsx +5 -0
- package/src/iframe/order-process/components/NavigationSteps/NavigationSteps.stories.tsx +2 -1
- package/src/iframe/order-process/components/PaymentCard/PaymentCard.stories.tsx +2 -1
- package/src/iframe/page/Page.stories.tsx +9 -8
- package/src/iframe/payment/order-items-table/OrderItemsTable.stories.tsx +2 -1
- package/src/iframe/payment/payment-status-header/PaymentStatusHeader.stories.tsx +2 -1
- package/src/index.ts +2 -0
- package/src/logo/Logo.stories.tsx +17 -14
- package/src/modals/confirmation/Confirmation.stories.tsx +2 -1
- package/src/notification/components/NotificationPlaceholders.stories.tsx +4 -0
- package/src/notification/components/NotificationPlaceholders.tsx +1 -1
- package/src/product-set/form/ProductCategoriesControl.tsx +12 -6
- package/src/product-set/form/ProductSetForm.stories.tsx +13 -4
- package/src/provider/location-input/LocationInput.stories.tsx +47 -2
- package/src/provider/provider-details-input/ProviderDetailsInput.stories.tsx +10 -1
- package/src/provider/provider-details-input/ProviderDetailsInput.tsx +1 -1
- package/src/provider/provider-form/ProviderForm.stories.tsx +46 -0
- package/src/provider/venue-form/VenueForm.stories.tsx +49 -0
- package/src/recurrence-input/RecurrenceEndInput.tsx +7 -5
- package/src/recurrence-input/RecurrenceInput.stories.tsx +3 -0
- package/src/resource/form/ResourceForm.stories.tsx +2 -1
- package/src/sales/guest-profile/previous-bookings/PreviousBookings.stories.tsx +2 -1
- package/src/sales/life-time-sales/LifeTimeSalesChart.stories.tsx +2 -1
- package/src/sales/manual-booking/select-date-type-control/SelectDateTypeControl.stories.tsx +2 -1
- package/src/sales/manual-booking/select-menu/SelectMenu.stories.tsx +2 -1
- package/src/sales/modals/payment-modal/PaymentModal.stories.tsx +3 -2
- package/src/sales/modals/refund-modal/RefundModal.stories.tsx +5 -4
- package/src/sales/payment-form/SalePaymentForm.stories.tsx +3 -2
- package/src/setting/dashboard/snippet-templates/card/SnippetTemplateCard.stories.tsx +2 -1
- package/src/snippet/snippet-template/SnippetTemplate.stories.tsx +2 -1
- package/src/snippet/snippet-template/form/SnippetTemplateForm.stories.tsx +4 -2
- package/src/sortable-tree/SortableTree.tsx +1 -1
- package/src/sortable-tree/SortableTreeItem.stories.tsx +12 -14
- package/src/styles/overrides/_functions.scss +1 -1
- package/src/table/Table.stories.tsx +3 -24
- package/src/tiptap-editor/TipTapMenu/TipTapMenu.stories.tsx +27 -3
- package/src/v2/components/Alert/Alert.scss +186 -0
- package/src/v2/components/Alert/Alert.stories.tsx +176 -0
- package/src/v2/components/Alert/Alert.tsx +62 -0
- package/src/v2/components/Alert/assets/alert-icon.svg +3 -0
- package/src/v2/components/Alert/assets/error-icon.svg +3 -0
- package/src/v2/components/Alert/assets/info-icon.svg +3 -0
- package/src/v2/components/Alert/assets/success-icon.svg +3 -0
- package/src/v2/components/Alert/index.ts +2 -0
- package/src/v2/components/Button/Button.scss +19 -0
- package/src/v2/components/Button/Button.stories.tsx +93 -0
- package/src/v2/components/Button/Button.tsx +37 -0
- package/src/v2/components/Button/index.ts +3 -0
- package/src/v2/components/Colors/Colors.scss +64 -0
- package/src/v2/components/Colors/Colors.stories.tsx +143 -0
- package/src/v2/components/Colors/Colors.tsx +51 -0
- package/src/v2/components/Colors/ColorsAliases.stories.tsx +285 -0
- package/src/v2/components/Colors/Sizes.stories.tsx +141 -0
- package/src/v2/components/Colors/index.ts +2 -0
- package/src/v2/components/Typography/Typography.scss +72 -0
- package/src/v2/components/Typography/Typography.stories.tsx +266 -0
- package/src/v2/components/Typography/Typography.tsx +56 -0
- package/src/v2/components/Typography/index.ts +2 -0
- package/src/v2/hooks/useAuth.ts +40 -0
- package/src/v2/index.ts +105 -0
- package/src/v2/navigation/FigmasAdminSideBar/FigmasAdminSideBar.scss +148 -0
- package/src/v2/navigation/FigmasAdminSideBar/FigmasAdminSideBar.stories.tsx +132 -0
- package/src/v2/navigation/FigmasAdminSideBar/FigmasAdminSideBar.tsx +272 -0
- package/src/v2/navigation/FigmasAdminSideBar/index.ts +2 -0
- package/src/v2/navigation/FigmasSideBar/FigmasSideBar.scss +214 -0
- package/src/v2/navigation/FigmasSideBar/FigmasSideBar.stories.tsx +164 -0
- package/src/v2/navigation/FigmasSideBar/FigmasSideBar.tsx +310 -0
- package/src/v2/navigation/FigmasSideBar/index.ts +2 -0
- package/src/v2/navigation/FigmasTopHat/FigmasTopHat.scss +291 -0
- package/src/v2/navigation/FigmasTopHat/FigmasTopHat.stories.tsx +201 -0
- package/src/v2/navigation/FigmasTopHat/FigmasTopHat.tsx +158 -0
- package/src/v2/navigation/FigmasTopHat/assets/bell-icon.svg +3 -0
- package/src/v2/navigation/FigmasTopHat/assets/disc-icon.svg +4 -0
- package/src/v2/navigation/FigmasTopHat/assets/inbox-icon.svg +3 -0
- package/src/v2/navigation/FigmasTopHat/assets/logo-desktop-1.svg +3 -0
- package/src/v2/navigation/FigmasTopHat/assets/logo-desktop-2.svg +4 -0
- package/src/v2/navigation/FigmasTopHat/assets/user-icon.svg +4 -0
- package/src/v2/navigation/FigmasTopHat/index.ts +2 -0
- package/src/v2/navigation/Navigation/Navigation.scss +15 -0
- package/src/v2/navigation/Navigation/Navigation.stories.tsx +137 -0
- package/src/v2/navigation/Navigation/Navigation.tsx +127 -0
- package/src/v2/navigation/Navigation/index.ts +3 -0
- package/src/v2/navigation/NavigationItem/NavigationItem.scss +61 -0
- package/src/v2/navigation/NavigationItem/NavigationItem.stories.tsx +110 -0
- package/src/v2/navigation/NavigationItem/NavigationItem.tsx +38 -0
- package/src/v2/navigation/NavigationItem/index.ts +3 -0
- package/src/v2/navigation/NavigationSection/NavigationSection.scss +20 -0
- package/src/v2/navigation/NavigationSection/NavigationSection.tsx +19 -0
- package/src/v2/navigation/NavigationSection/index.ts +3 -0
- package/src/v2/navigation/SideBarToggleLarge/SideBarToggleLarge.scss +64 -0
- package/src/v2/navigation/SideBarToggleLarge/SideBarToggleLarge.stories.tsx +183 -0
- package/src/v2/navigation/SideBarToggleLarge/SideBarToggleLarge.tsx +30 -0
- package/src/v2/navigation/SideBarToggleLarge/assets/sidebar-icon.svg +5 -0
- package/src/v2/navigation/SideBarToggleLarge/index.ts +2 -0
- package/src/v2/navigation/SidebarUserElement/SidebarUserElement.scss +148 -0
- package/src/v2/navigation/SidebarUserElement/SidebarUserElement.stories.tsx +342 -0
- package/src/v2/navigation/SidebarUserElement/SidebarUserElement.tsx +113 -0
- package/src/v2/navigation/SidebarUserElement/index.ts +2 -0
- package/src/v2/navigation/SidebarWithAuth.stories.tsx +208 -0
- package/src/v2/navigation/SidebarWithAuth.tsx +49 -0
- package/src/v2/navigation/TopHatControlDisc/TopHatControlDisc.scss +57 -0
- package/src/v2/navigation/TopHatControlDisc/TopHatControlDisc.stories.tsx +153 -0
- package/src/v2/navigation/TopHatControlDisc/TopHatControlDisc.tsx +30 -0
- package/src/v2/navigation/TopHatControlDisc/assets/disc-icon.svg +4 -0
- package/src/v2/navigation/TopHatControlDisc/index.ts +2 -0
- package/src/v2/navigation/config.tsx +150 -0
- package/src/v2/navigation/icons/index.tsx +72 -0
- package/src/v2/navigation/index.ts +23 -0
- package/src/v2/styles/components/Button.scss +168 -0
- package/src/v2/styles/form/NewInput.scss +172 -0
- package/src/v2/styles/index.scss +5 -0
- package/src/v2/styles/navigation/Navigation.scss +17 -0
- package/src/v2/styles/navigation/NavigationItem.scss +86 -0
- package/src/v2/styles/navigation/NavigationSection.scss +26 -0
- package/src/v2/styles/navigation/_index.scss +9 -0
- package/src/v2/styles/tokens/_aliases.scss +199 -0
- package/src/v2/styles/tokens/_colors.scss +121 -0
- package/src/v2/styles/tokens/_sizes.scss +122 -0
- package/src/v2/styles/tokens/_status.scss +108 -0
- package/src/v2/styles/tokens/_typography.scss +146 -0
- package/src/v2/types/navigation.ts +17 -0
- package/src/zone/form/ZoneForm.stories.tsx +2 -1
- package/styles/overrides/_functions.scss +6 -0
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { SidebarUserElement } from './SidebarUserElement'
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'v2/Navigation/Sidebar User Element',
|
|
7
|
+
component: SidebarUserElement,
|
|
8
|
+
argTypes: {
|
|
9
|
+
variant: {
|
|
10
|
+
control: 'select',
|
|
11
|
+
options: ['default', 'hover', 'dropdown'],
|
|
12
|
+
description: 'Visual state of the user element',
|
|
13
|
+
},
|
|
14
|
+
userName: {
|
|
15
|
+
control: 'text',
|
|
16
|
+
description: 'User display name',
|
|
17
|
+
},
|
|
18
|
+
userEmail: {
|
|
19
|
+
control: 'text',
|
|
20
|
+
description: 'User email address',
|
|
21
|
+
},
|
|
22
|
+
showDropdown: {
|
|
23
|
+
control: 'boolean',
|
|
24
|
+
description: 'Whether to show the dropdown menu',
|
|
25
|
+
},
|
|
26
|
+
onSiteAdminClick: { action: 'site admin clicked' },
|
|
27
|
+
onProfileClick: { action: 'profile clicked' },
|
|
28
|
+
onLogOutClick: { action: 'log out clicked' },
|
|
29
|
+
onUserClick: { action: 'user clicked' },
|
|
30
|
+
className: {
|
|
31
|
+
control: 'text',
|
|
32
|
+
description: 'Additional CSS classes',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
parameters: {
|
|
36
|
+
layout: 'centered',
|
|
37
|
+
},
|
|
38
|
+
} as Meta
|
|
39
|
+
|
|
40
|
+
type Story = StoryObj<typeof SidebarUserElement>
|
|
41
|
+
|
|
42
|
+
export const Default: Story = {
|
|
43
|
+
args: {
|
|
44
|
+
variant: 'default',
|
|
45
|
+
userName: 'Matt Emmins',
|
|
46
|
+
userEmail: 'matt.emmins@booked.it',
|
|
47
|
+
showDropdown: false,
|
|
48
|
+
},
|
|
49
|
+
decorators: [
|
|
50
|
+
(Story) => (
|
|
51
|
+
<div style={{ width: '252px', height: '56px', border: '1px solid #E8E9EF', borderRadius: '8px' }}>
|
|
52
|
+
<Story />
|
|
53
|
+
</div>
|
|
54
|
+
),
|
|
55
|
+
],
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export const Hover: Story = {
|
|
59
|
+
args: {
|
|
60
|
+
variant: 'hover',
|
|
61
|
+
userName: 'Matt Emmins',
|
|
62
|
+
userEmail: 'matt.emmins@booked.it',
|
|
63
|
+
showDropdown: false,
|
|
64
|
+
},
|
|
65
|
+
decorators: [
|
|
66
|
+
(Story) => (
|
|
67
|
+
<div style={{ width: '252px', height: '56px', border: '1px solid #E8E9EF', borderRadius: '8px' }}>
|
|
68
|
+
<Story />
|
|
69
|
+
</div>
|
|
70
|
+
),
|
|
71
|
+
],
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export const Dropdown: Story = {
|
|
75
|
+
args: {
|
|
76
|
+
variant: 'dropdown',
|
|
77
|
+
userName: 'Matt Emmins',
|
|
78
|
+
userEmail: 'matt.emmins@booked.it',
|
|
79
|
+
showDropdown: true,
|
|
80
|
+
},
|
|
81
|
+
decorators: [
|
|
82
|
+
(Story) => (
|
|
83
|
+
<div style={{ width: '252px', height: 'auto', border: '1px solid #E8E9EF', borderRadius: '8px' }}>
|
|
84
|
+
<Story />
|
|
85
|
+
</div>
|
|
86
|
+
),
|
|
87
|
+
],
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export const Interactive: Story = {
|
|
91
|
+
render: function (args) {
|
|
92
|
+
const [variant, setVariant] = React.useState<'default' | 'hover' | 'dropdown'>('default');
|
|
93
|
+
const [showDropdown, setShowDropdown] = React.useState(false);
|
|
94
|
+
|
|
95
|
+
const handleUserClick = () => {
|
|
96
|
+
args.onUserClick?.();
|
|
97
|
+
if (variant === 'dropdown') {
|
|
98
|
+
setShowDropdown(false);
|
|
99
|
+
setVariant('default');
|
|
100
|
+
} else {
|
|
101
|
+
setShowDropdown(true);
|
|
102
|
+
setVariant('dropdown');
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
return (
|
|
107
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '20px', alignItems: 'center' }}>
|
|
108
|
+
<div style={{ width: '252px', height: variant === 'dropdown' ? 'auto' : '56px', border: '1px solid #E8E9EF', borderRadius: '8px' }}>
|
|
109
|
+
<SidebarUserElement
|
|
110
|
+
{...args}
|
|
111
|
+
variant={variant}
|
|
112
|
+
showDropdown={showDropdown}
|
|
113
|
+
onUserClick={handleUserClick}
|
|
114
|
+
onSiteAdminClick={() => {
|
|
115
|
+
args.onSiteAdminClick?.();
|
|
116
|
+
alert('Site Admin clicked!');
|
|
117
|
+
}}
|
|
118
|
+
onProfileClick={() => {
|
|
119
|
+
args.onProfileClick?.();
|
|
120
|
+
alert('Profile clicked!');
|
|
121
|
+
}}
|
|
122
|
+
onLogOutClick={() => {
|
|
123
|
+
args.onLogOutClick?.();
|
|
124
|
+
alert('Log Out clicked!');
|
|
125
|
+
}}
|
|
126
|
+
/>
|
|
127
|
+
</div>
|
|
128
|
+
|
|
129
|
+
<div style={{ display: 'flex', gap: '8px', flexDirection: 'column', alignItems: 'center' }}>
|
|
130
|
+
<div style={{ display: 'flex', gap: '8px' }}>
|
|
131
|
+
<button
|
|
132
|
+
onClick={() => { setVariant('default'); setShowDropdown(false); }}
|
|
133
|
+
style={{
|
|
134
|
+
padding: '4px 8px',
|
|
135
|
+
backgroundColor: variant === 'default' ? '#14215A' : '#E8E9EF',
|
|
136
|
+
color: variant === 'default' ? 'white' : '#121E52',
|
|
137
|
+
border: 'none',
|
|
138
|
+
borderRadius: '4px',
|
|
139
|
+
cursor: 'pointer',
|
|
140
|
+
fontSize: '12px'
|
|
141
|
+
}}
|
|
142
|
+
>
|
|
143
|
+
Default
|
|
144
|
+
</button>
|
|
145
|
+
<button
|
|
146
|
+
onClick={() => { setVariant('hover'); setShowDropdown(false); }}
|
|
147
|
+
style={{
|
|
148
|
+
padding: '4px 8px',
|
|
149
|
+
backgroundColor: variant === 'hover' ? '#14215A' : '#E8E9EF',
|
|
150
|
+
color: variant === 'hover' ? 'white' : '#121E52',
|
|
151
|
+
border: 'none',
|
|
152
|
+
borderRadius: '4px',
|
|
153
|
+
cursor: 'pointer',
|
|
154
|
+
fontSize: '12px'
|
|
155
|
+
}}
|
|
156
|
+
>
|
|
157
|
+
Hover
|
|
158
|
+
</button>
|
|
159
|
+
<button
|
|
160
|
+
onClick={() => { setVariant('dropdown'); setShowDropdown(true); }}
|
|
161
|
+
style={{
|
|
162
|
+
padding: '4px 8px',
|
|
163
|
+
backgroundColor: variant === 'dropdown' ? '#14215A' : '#E8E9EF',
|
|
164
|
+
color: variant === 'dropdown' ? 'white' : '#121E52',
|
|
165
|
+
border: 'none',
|
|
166
|
+
borderRadius: '4px',
|
|
167
|
+
cursor: 'pointer',
|
|
168
|
+
fontSize: '12px'
|
|
169
|
+
}}
|
|
170
|
+
>
|
|
171
|
+
Dropdown
|
|
172
|
+
</button>
|
|
173
|
+
</div>
|
|
174
|
+
<p style={{ fontSize: '12px', color: '#626A90', margin: '0' }}>
|
|
175
|
+
Click the user element to toggle dropdown
|
|
176
|
+
</p>
|
|
177
|
+
</div>
|
|
178
|
+
</div>
|
|
179
|
+
);
|
|
180
|
+
},
|
|
181
|
+
args: {
|
|
182
|
+
userName: 'Matt Emmins',
|
|
183
|
+
userEmail: 'matt.emmins@booked.it',
|
|
184
|
+
},
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export const AllStates: Story = {
|
|
188
|
+
render: () => (
|
|
189
|
+
<div style={{ display: 'flex', gap: '16px', alignItems: 'flex-start', padding: '20px', backgroundColor: '#f0f0f0' }}>
|
|
190
|
+
<div style={{ textAlign: 'center' }}>
|
|
191
|
+
<div style={{ width: '252px', height: '56px', border: '1px solid #E8E9EF', borderRadius: '8px', marginBottom: '8px' }}>
|
|
192
|
+
<SidebarUserElement variant="default" />
|
|
193
|
+
</div>
|
|
194
|
+
<span style={{ fontSize: '12px', color: '#626A90' }}>Default</span>
|
|
195
|
+
</div>
|
|
196
|
+
<div style={{ textAlign: 'center' }}>
|
|
197
|
+
<div style={{ width: '252px', height: '56px', border: '1px solid #E8E9EF', borderRadius: '8px', marginBottom: '8px' }}>
|
|
198
|
+
<SidebarUserElement variant="hover" />
|
|
199
|
+
</div>
|
|
200
|
+
<span style={{ fontSize: '12px', color: '#626A90' }}>Hover</span>
|
|
201
|
+
</div>
|
|
202
|
+
<div style={{ textAlign: 'center' }}>
|
|
203
|
+
<div style={{ width: '252px', height: 'auto', border: '1px solid #E8E9EF', borderRadius: '8px', marginBottom: '8px' }}>
|
|
204
|
+
<SidebarUserElement variant="dropdown" showDropdown={true} />
|
|
205
|
+
</div>
|
|
206
|
+
<span style={{ fontSize: '12px', color: '#626A90' }}>Dropdown</span>
|
|
207
|
+
</div>
|
|
208
|
+
</div>
|
|
209
|
+
),
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export const InSidebarContext: Story = {
|
|
213
|
+
render: () => {
|
|
214
|
+
const [expanded, setExpanded] = React.useState(false)
|
|
215
|
+
|
|
216
|
+
return (
|
|
217
|
+
<div style={{ height: '100vh', display: 'flex', backgroundColor: '#F8F8FA' }}>
|
|
218
|
+
{/* Sidebar */}
|
|
219
|
+
<div style={{
|
|
220
|
+
width: expanded ? '240px' : '56px',
|
|
221
|
+
backgroundColor: '#F8F8FA',
|
|
222
|
+
borderRight: '1px solid #E8E9EF',
|
|
223
|
+
display: 'flex',
|
|
224
|
+
flexDirection: 'column',
|
|
225
|
+
position: 'relative'
|
|
226
|
+
}}>
|
|
227
|
+
{/* Sidebar content */}
|
|
228
|
+
<div style={{ flex: 1, overflow: 'hidden' }}>
|
|
229
|
+
<div style={{ padding: '8px' }}>
|
|
230
|
+
<div style={{
|
|
231
|
+
height: expanded ? '80px' : '48px',
|
|
232
|
+
backgroundColor: '#ffffff',
|
|
233
|
+
border: '1px solid #E8E9EF',
|
|
234
|
+
borderRadius: '8px',
|
|
235
|
+
display: 'flex',
|
|
236
|
+
alignItems: 'center',
|
|
237
|
+
padding: expanded ? '12px' : '8px',
|
|
238
|
+
gap: '8px'
|
|
239
|
+
}}>
|
|
240
|
+
{expanded ? (
|
|
241
|
+
<>
|
|
242
|
+
<div style={{ width: '40px', height: '40px', borderRadius: '50%', backgroundColor: '#E8E9EF' }} />
|
|
243
|
+
<div style={{ flex: 1 }}>
|
|
244
|
+
<div style={{ fontSize: '15px', fontWeight: 600, color: '#121E52' }}>Venue Name</div>
|
|
245
|
+
<div style={{ fontSize: '10px', color: '#626A90' }}>ID: 123</div>
|
|
246
|
+
</div>
|
|
247
|
+
</>
|
|
248
|
+
) : (
|
|
249
|
+
<div style={{ width: '32px', height: '32px', borderRadius: '50%', backgroundColor: '#14215A', margin: '0 auto' }} />
|
|
250
|
+
)}
|
|
251
|
+
</div>
|
|
252
|
+
</div>
|
|
253
|
+
|
|
254
|
+
{/* Navigation items */}
|
|
255
|
+
<div style={{ padding: '4px' }}>
|
|
256
|
+
{Array(10).fill(0).map((_, i) => (
|
|
257
|
+
<div key={i} style={{
|
|
258
|
+
padding: expanded ? '8px' : '8px',
|
|
259
|
+
marginBottom: '4px',
|
|
260
|
+
display: 'flex',
|
|
261
|
+
alignItems: 'center',
|
|
262
|
+
gap: '8px'
|
|
263
|
+
}}>
|
|
264
|
+
<div style={{
|
|
265
|
+
width: '24px',
|
|
266
|
+
height: '24px',
|
|
267
|
+
backgroundColor: '#E8E9EF',
|
|
268
|
+
borderRadius: '4px'
|
|
269
|
+
}} />
|
|
270
|
+
{expanded && <div style={{ fontSize: '13px', color: '#121E52' }}>Nav Item {i + 1}</div>}
|
|
271
|
+
</div>
|
|
272
|
+
))}
|
|
273
|
+
</div>
|
|
274
|
+
</div>
|
|
275
|
+
|
|
276
|
+
{/* User element at bottom */}
|
|
277
|
+
<div style={{
|
|
278
|
+
padding: '8px',
|
|
279
|
+
backgroundColor: '#F8F8FA',
|
|
280
|
+
borderTop: '1px solid #E8E9EF',
|
|
281
|
+
position: 'absolute',
|
|
282
|
+
bottom: 0,
|
|
283
|
+
left: 0,
|
|
284
|
+
right: 0
|
|
285
|
+
}}>
|
|
286
|
+
{expanded ? (
|
|
287
|
+
<SidebarUserElement variant="default" showDropdown={false} />
|
|
288
|
+
) : (
|
|
289
|
+
<div style={{ display: 'flex', justifyContent: 'center' }}>
|
|
290
|
+
<div style={{
|
|
291
|
+
width: '40px',
|
|
292
|
+
height: '40px',
|
|
293
|
+
borderRadius: '50%',
|
|
294
|
+
backgroundColor: '#E8E9EF',
|
|
295
|
+
border: '1px solid #E8E9EF'
|
|
296
|
+
}} />
|
|
297
|
+
</div>
|
|
298
|
+
)}
|
|
299
|
+
</div>
|
|
300
|
+
</div>
|
|
301
|
+
|
|
302
|
+
<div style={{ flex: 1, display: 'flex', flexDirection: 'column' }}>
|
|
303
|
+
<div style={{
|
|
304
|
+
height: '60px',
|
|
305
|
+
backgroundColor: '#ffffff',
|
|
306
|
+
borderBottom: '1px solid #E8E9EF',
|
|
307
|
+
display: 'flex',
|
|
308
|
+
alignItems: 'center',
|
|
309
|
+
padding: '0 20px',
|
|
310
|
+
gap: '12px'
|
|
311
|
+
}}>
|
|
312
|
+
<button
|
|
313
|
+
onClick={() => setExpanded(!expanded)}
|
|
314
|
+
style={{
|
|
315
|
+
padding: '8px',
|
|
316
|
+
backgroundColor: '#14215A',
|
|
317
|
+
color: 'white',
|
|
318
|
+
border: 'none',
|
|
319
|
+
borderRadius: '6px',
|
|
320
|
+
cursor: 'pointer',
|
|
321
|
+
fontSize: '12px'
|
|
322
|
+
}}
|
|
323
|
+
>
|
|
324
|
+
{expanded ? 'Collapse' : 'Expand'}
|
|
325
|
+
</button>
|
|
326
|
+
<h1 style={{ margin: 0, fontSize: '18px', color: '#121E52' }}>Dashboard</h1>
|
|
327
|
+
</div>
|
|
328
|
+
<div style={{ flex: 1, padding: '20px', backgroundColor: '#ffffff', margin: '8px', borderRadius: '8px' }}>
|
|
329
|
+
<h2>Main Content</h2>
|
|
330
|
+
<p>This shows how the user element integrates with a sidebar layout.</p>
|
|
331
|
+
<p style={{ marginTop: '16px', fontSize: '14px', color: '#626A90' }}>
|
|
332
|
+
Sidebar is {expanded ? 'expanded' : 'collapsed'}. Click the button to toggle.
|
|
333
|
+
</p>
|
|
334
|
+
<p style={{ fontSize: '14px', color: '#626A90' }}>
|
|
335
|
+
User element shows full info when expanded, and only avatar icon when collapsed.
|
|
336
|
+
</p>
|
|
337
|
+
</div>
|
|
338
|
+
</div>
|
|
339
|
+
</div>
|
|
340
|
+
)
|
|
341
|
+
},
|
|
342
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import './SidebarUserElement.scss'
|
|
3
|
+
|
|
4
|
+
// Icon assets for dropdown menu items
|
|
5
|
+
const AdminIcon = () => (
|
|
6
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
7
|
+
<path d="M12 2L13.09 8.26L22 9L13.09 9.74L12 16L10.91 9.74L2 9L10.91 8.26L12 2Z" fill="var(--fills-main-fill-primary, #14215A)" />
|
|
8
|
+
<path d="M19 15L20.09 18.26L24 19L20.09 19.74L19 23L17.91 19.74L14 19L17.91 18.26L19 15Z" fill="var(--fills-main-fill-primary, #14215A)" />
|
|
9
|
+
<path d="M5 15L6.09 18.26L10 19L6.09 19.74L5 23L3.91 19.74L0 19L3.91 18.26L5 15Z" fill="var(--fills-main-fill-primary, #14215A)" />
|
|
10
|
+
</svg>
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
const ProfileIcon = () => (
|
|
14
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
15
|
+
<path d="M12 12C14.7614 12 17 9.76142 17 7C17 4.23858 14.7614 2 12 2C9.23858 2 7 4.23858 7 7C7 9.76142 9.23858 12 12 12Z" fill="var(--fills-main-fill-primary, #14215A)" />
|
|
16
|
+
<path d="M12 14C7.58172 14 4 17.5817 4 22H20C20 17.5817 16.4183 14 12 14Z" fill="var(--fills-main-fill-primary, #14215A)" />
|
|
17
|
+
</svg>
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
const LogoutIcon = () => (
|
|
21
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
22
|
+
<path d="M17 7L15.59 8.41L18.17 11H8V13H18.17L15.59 15.59L17 17L22 12L17 7Z" fill="var(--fills-main-fill-primary, #14215A)" />
|
|
23
|
+
<path d="M4 5H12V3H4C2.9 3 2 3.9 2 5V19C2 20.1 2.9 21 4 21H12V19H4V5Z" fill="var(--fills-main-fill-primary, #14215A)" />
|
|
24
|
+
</svg>
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
export interface SidebarUserElementProps {
|
|
28
|
+
variant?: 'default' | 'hover' | 'dropdown'
|
|
29
|
+
userName?: string
|
|
30
|
+
userEmail?: string
|
|
31
|
+
showDropdown?: boolean
|
|
32
|
+
onSiteAdminClick?: () => void
|
|
33
|
+
onProfileClick?: () => void
|
|
34
|
+
onLogOutClick?: () => void
|
|
35
|
+
onUserClick?: () => void
|
|
36
|
+
className?: string
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const SidebarUserElement: React.FC<SidebarUserElementProps> = ({
|
|
40
|
+
variant = 'default',
|
|
41
|
+
userName = 'Matt Emmins',
|
|
42
|
+
userEmail = 'matt.emmins@booked.it',
|
|
43
|
+
showDropdown = false,
|
|
44
|
+
onSiteAdminClick,
|
|
45
|
+
onProfileClick,
|
|
46
|
+
onLogOutClick,
|
|
47
|
+
onUserClick,
|
|
48
|
+
className,
|
|
49
|
+
}) => {
|
|
50
|
+
const userInfo = (
|
|
51
|
+
<div className="sidebar-user-element__user-info">
|
|
52
|
+
<div className="sidebar-user-element__avatar" data-property-1="No User">
|
|
53
|
+
<div className="sidebar-user-element__avatar-circle"></div>
|
|
54
|
+
</div>
|
|
55
|
+
<div className="sidebar-user-element__user-details">
|
|
56
|
+
<div className="sidebar-user-element__user-name">{userName}</div>
|
|
57
|
+
<div className="sidebar-user-element__user-email">{userEmail}</div>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
const dropdownMenu = (
|
|
63
|
+
<div className="sidebar-user-element__dropdown">
|
|
64
|
+
<div className="sidebar-user-element__dropdown-items">
|
|
65
|
+
<div className="sidebar-user-element__dropdown-item" data-property-1="Default">
|
|
66
|
+
<div
|
|
67
|
+
className="sidebar-user-element__dropdown-link"
|
|
68
|
+
onClick={onSiteAdminClick}
|
|
69
|
+
>
|
|
70
|
+
<div className="sidebar-user-element__dropdown-icon" data-icon="Admin">
|
|
71
|
+
<AdminIcon />
|
|
72
|
+
</div>
|
|
73
|
+
<div className="sidebar-user-element__dropdown-text">Site Admin</div>
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
<div className="sidebar-user-element__dropdown-item" data-property-1="Default">
|
|
78
|
+
<div
|
|
79
|
+
className="sidebar-user-element__dropdown-link"
|
|
80
|
+
onClick={onProfileClick}
|
|
81
|
+
>
|
|
82
|
+
<div className="sidebar-user-element__dropdown-icon" data-icon="User Settings">
|
|
83
|
+
<ProfileIcon />
|
|
84
|
+
</div>
|
|
85
|
+
<div className="sidebar-user-element__dropdown-text">Profile</div>
|
|
86
|
+
</div>
|
|
87
|
+
</div>
|
|
88
|
+
|
|
89
|
+
<div className="sidebar-user-element__dropdown-item" data-property-1="Default">
|
|
90
|
+
<div
|
|
91
|
+
className="sidebar-user-element__dropdown-link"
|
|
92
|
+
onClick={onLogOutClick}
|
|
93
|
+
>
|
|
94
|
+
<div className="sidebar-user-element__dropdown-icon" data-icon="Log out">
|
|
95
|
+
<LogoutIcon />
|
|
96
|
+
</div>
|
|
97
|
+
<div className="sidebar-user-element__dropdown-text">Log Out</div>
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
{userInfo}
|
|
102
|
+
</div>
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<div
|
|
107
|
+
className={`sidebar-user-element sidebar-user-element--${variant} ${className || ''}`}
|
|
108
|
+
onClick={onUserClick}
|
|
109
|
+
>
|
|
110
|
+
{showDropdown ? dropdownMenu : userInfo}
|
|
111
|
+
</div>
|
|
112
|
+
)
|
|
113
|
+
}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { SidebarWithAuth } from './SidebarWithAuth'
|
|
4
|
+
import { NAVIGATION_ITEMS } from './config'
|
|
5
|
+
import { useAuth } from '../hooks/useAuth'
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'v2/Navigation/Sidebar with Auth',
|
|
9
|
+
component: SidebarWithAuth,
|
|
10
|
+
argTypes: {
|
|
11
|
+
expanded: {
|
|
12
|
+
control: 'boolean',
|
|
13
|
+
description: 'Whether the sidebar is expanded',
|
|
14
|
+
},
|
|
15
|
+
venueName: { control: 'text' },
|
|
16
|
+
venueId: { control: 'text' },
|
|
17
|
+
},
|
|
18
|
+
parameters: {
|
|
19
|
+
layout: 'fullscreen',
|
|
20
|
+
},
|
|
21
|
+
} as Meta
|
|
22
|
+
|
|
23
|
+
type Story = StoryObj<typeof SidebarWithAuth>
|
|
24
|
+
|
|
25
|
+
export const WithFullAccess: Story = {
|
|
26
|
+
args: {
|
|
27
|
+
expanded: true,
|
|
28
|
+
navigationItems: NAVIGATION_ITEMS,
|
|
29
|
+
authCredentials: {
|
|
30
|
+
roles: ['admin'],
|
|
31
|
+
permissions: ['view_reports', 'manage_bookings', 'send_messages', 'view_customers', 'view_analytics', 'manage_venue_settings'],
|
|
32
|
+
isAdmin: true,
|
|
33
|
+
isVenueUser: true,
|
|
34
|
+
venueId: '123'
|
|
35
|
+
},
|
|
36
|
+
activePath: '/home',
|
|
37
|
+
onNavigation: (path: string) => {
|
|
38
|
+
console.log('Navigate to:', path)
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
decorators: [
|
|
42
|
+
(Story) => (
|
|
43
|
+
<div style={{ display: 'flex', height: '100vh' }}>
|
|
44
|
+
<Story />
|
|
45
|
+
<main style={{ flex: 1, padding: '20px', backgroundColor: '#ffffff' }}>
|
|
46
|
+
<h2>Main Content Area</h2>
|
|
47
|
+
<p>This is where the main content would be displayed based on the selected navigation item.</p>
|
|
48
|
+
<div style={{ marginTop: '20px' }}>
|
|
49
|
+
<h3>Available Pages (based on auth):</h3>
|
|
50
|
+
<ul>
|
|
51
|
+
{NAVIGATION_ITEMS.map(item => (
|
|
52
|
+
<li key={item.id}>
|
|
53
|
+
<a href={`#${item.path}`} style={{ color: '#14215A' }}>{item.label}</a>
|
|
54
|
+
{' '}
|
|
55
|
+
{item.requiredPermissions && (
|
|
56
|
+
<span style={{ fontSize: '12px', color: '#626A90' }}>
|
|
57
|
+
(requires: {item.requiredPermissions.join(', ')})
|
|
58
|
+
</span>
|
|
59
|
+
)}
|
|
60
|
+
</li>
|
|
61
|
+
))}
|
|
62
|
+
</ul>
|
|
63
|
+
</div>
|
|
64
|
+
</main>
|
|
65
|
+
</div>
|
|
66
|
+
),
|
|
67
|
+
],
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export const WithLimitedAccess: Story = {
|
|
71
|
+
args: {
|
|
72
|
+
expanded: true,
|
|
73
|
+
navigationItems: NAVIGATION_ITEMS,
|
|
74
|
+
authCredentials: {
|
|
75
|
+
roles: ['venue_user'],
|
|
76
|
+
permissions: ['view_bookings'],
|
|
77
|
+
isAdmin: false,
|
|
78
|
+
isVenueUser: true,
|
|
79
|
+
venueId: '123'
|
|
80
|
+
},
|
|
81
|
+
activePath: '/bookings',
|
|
82
|
+
onNavigation: (path: string) => {
|
|
83
|
+
console.log('Navigate to:', path)
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
decorators: [
|
|
87
|
+
(Story) => (
|
|
88
|
+
<div style={{ display: 'flex', height: '100vh' }}>
|
|
89
|
+
<Story />
|
|
90
|
+
<main style={{ flex: 1, padding: '20px', backgroundColor: '#ffffff' }}>
|
|
91
|
+
<h2>Limited Access User</h2>
|
|
92
|
+
<p>This user only has access to basic pages without special permissions.</p>
|
|
93
|
+
<div style={{ marginTop: '20px' }}>
|
|
94
|
+
<h3>Accessible Pages:</h3>
|
|
95
|
+
<ul>
|
|
96
|
+
{NAVIGATION_ITEMS.filter(item => {
|
|
97
|
+
// Simulate filtering based on auth
|
|
98
|
+
if (item.requiredPermissions && item.requiredPermissions.length > 0) {
|
|
99
|
+
return item.requiredPermissions.some(perm => ['view_bookings'].includes(perm))
|
|
100
|
+
}
|
|
101
|
+
if (item.venueRequired) return true
|
|
102
|
+
return false
|
|
103
|
+
}).map(item => (
|
|
104
|
+
<li key={item.id}>
|
|
105
|
+
<a href={`#${item.path}`} style={{ color: '#14215A' }}>{item.label}</a>
|
|
106
|
+
</li>
|
|
107
|
+
))}
|
|
108
|
+
</ul>
|
|
109
|
+
</div>
|
|
110
|
+
</main>
|
|
111
|
+
</div>
|
|
112
|
+
),
|
|
113
|
+
],
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export const WithNoAuth: Story = {
|
|
117
|
+
args: {
|
|
118
|
+
expanded: true,
|
|
119
|
+
navigationItems: NAVIGATION_ITEMS,
|
|
120
|
+
authCredentials: {
|
|
121
|
+
roles: [],
|
|
122
|
+
permissions: [],
|
|
123
|
+
isAdmin: false,
|
|
124
|
+
isVenueUser: false,
|
|
125
|
+
},
|
|
126
|
+
activePath: '/home',
|
|
127
|
+
onNavigation: (path: string) => {
|
|
128
|
+
console.log('Navigate to:', path)
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
decorators: [
|
|
132
|
+
(Story) => (
|
|
133
|
+
<div style={{ display: 'flex', height: '100vh' }}>
|
|
134
|
+
<Story />
|
|
135
|
+
<main style={{ flex: 1, padding: '20px', backgroundColor: '#ffffff' }}>
|
|
136
|
+
<h2>No Auth User</h2>
|
|
137
|
+
<p>This user has no venue access, so most pages are hidden.</p>
|
|
138
|
+
<div style={{ marginTop: '20px' }}>
|
|
139
|
+
<p>Only non-venue-required pages would be visible.</p>
|
|
140
|
+
</div>
|
|
141
|
+
</main>
|
|
142
|
+
</div>
|
|
143
|
+
),
|
|
144
|
+
],
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export const Interactive: Story = {
|
|
148
|
+
render: (args) => {
|
|
149
|
+
const [currentPath, setCurrentPath] = React.useState('/home')
|
|
150
|
+
|
|
151
|
+
return (
|
|
152
|
+
<div style={{ display: 'flex', height: '100vh' }}>
|
|
153
|
+
<SidebarWithAuth
|
|
154
|
+
{...args}
|
|
155
|
+
activePath={currentPath}
|
|
156
|
+
onNavigation={(path) => {
|
|
157
|
+
setCurrentPath(path)
|
|
158
|
+
args.onNavigation?.(path)
|
|
159
|
+
}}
|
|
160
|
+
/>
|
|
161
|
+
<main style={{ flex: 1, padding: '20px', backgroundColor: '#ffffff' }}>
|
|
162
|
+
<h2>Interactive Navigation</h2>
|
|
163
|
+
<p>Current page: <strong>{currentPath}</strong></p>
|
|
164
|
+
<p>Click on sidebar items to navigate between pages.</p>
|
|
165
|
+
<div style={{ marginTop: '20px', padding: '16px', backgroundColor: '#F8F8FA', borderRadius: '8px' }}>
|
|
166
|
+
<h3>Routes Available:</h3>
|
|
167
|
+
<ul>
|
|
168
|
+
{NAVIGATION_ITEMS.map(item => (
|
|
169
|
+
<li key={item.id}>
|
|
170
|
+
<button
|
|
171
|
+
onClick={() => setCurrentPath(item.path)}
|
|
172
|
+
style={{
|
|
173
|
+
padding: '4px 8px',
|
|
174
|
+
backgroundColor: currentPath === item.path ? '#14215A' : '#E8E9EF',
|
|
175
|
+
color: currentPath === item.path ? 'white' : '#121E52',
|
|
176
|
+
border: 'none',
|
|
177
|
+
borderRadius: '4px',
|
|
178
|
+
cursor: 'pointer',
|
|
179
|
+
fontSize: '12px',
|
|
180
|
+
margin: '2px'
|
|
181
|
+
}}
|
|
182
|
+
>
|
|
183
|
+
{item.label}
|
|
184
|
+
</button>
|
|
185
|
+
</li>
|
|
186
|
+
))}
|
|
187
|
+
</ul>
|
|
188
|
+
</div>
|
|
189
|
+
</main>
|
|
190
|
+
</div>
|
|
191
|
+
)
|
|
192
|
+
},
|
|
193
|
+
args: {
|
|
194
|
+
expanded: true,
|
|
195
|
+
navigationItems: NAVIGATION_ITEMS,
|
|
196
|
+
authCredentials: {
|
|
197
|
+
roles: ['admin', 'venue_manager'],
|
|
198
|
+
permissions: ['view_reports', 'manage_bookings', 'send_messages', 'view_customers', 'view_analytics', 'manage_venue_settings'],
|
|
199
|
+
isAdmin: true,
|
|
200
|
+
isVenueUser: true,
|
|
201
|
+
venueId: '123'
|
|
202
|
+
},
|
|
203
|
+
activePath: '/home',
|
|
204
|
+
onNavigation: (path: string) => {
|
|
205
|
+
console.log('Navigate to:', path)
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
}
|