@beydesign/storybook 0.0.21 → 0.0.23
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/dist/index.d.ts +6 -0
- package/dist/index.js +9 -0
- package/dist/stories/CreditsCard.d.ts +3 -0
- package/dist/stories/CreditsCard.js +45 -0
- package/dist/stories/CreditsCard.stories.d.ts +7 -0
- package/dist/stories/CreditsCard.stories.js +31 -0
- package/dist/stories/NavItem.d.ts +3 -0
- package/dist/stories/NavItem.js +64 -0
- package/dist/stories/NavItem.stories.d.ts +14 -0
- package/dist/stories/NavItem.stories.js +100 -0
- package/dist/stories/Sidebar.d.ts +3 -0
- package/dist/stories/Sidebar.js +105 -0
- package/dist/stories/Sidebar.stories.d.ts +9 -0
- package/dist/stories/Sidebar.stories.js +234 -0
- package/dist/stories/types/credits-card.d.ts +35 -0
- package/dist/stories/types/credits-card.js +11 -0
- package/dist/stories/types/nav-item.d.ts +40 -0
- package/dist/stories/types/nav-item.js +11 -0
- package/dist/stories/types/sidebar.d.ts +82 -0
- package/dist/stories/types/sidebar.js +5 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,9 @@ export { ProgressIndicator } from './stories/ProgressIndicator';
|
|
|
8
8
|
export { Logo } from './stories/Logo';
|
|
9
9
|
export { Toggle } from './stories/Toggle';
|
|
10
10
|
export { Header } from './stories/Header';
|
|
11
|
+
export { NavItem } from './stories/NavItem';
|
|
12
|
+
export { CreditsCard } from './stories/CreditsCard';
|
|
13
|
+
export { Sidebar } from './stories/Sidebar';
|
|
11
14
|
export { ButtonSize, ButtonHierarchy, ButtonState, ButtonShape, ButtonDisplayMode, ButtonType, type MainButtonProps, } from './stories/types/button';
|
|
12
15
|
export { BadgeColor, BadgeSize, type BadgeProps } from './stories/types/badge';
|
|
13
16
|
export { AvatarStyle, AvatarSize, type AvatarProps, } from './stories/types/avatar';
|
|
@@ -18,3 +21,6 @@ export { ProgressIndicatorMode, type ProgressIndicatorProps, } from './stories/t
|
|
|
18
21
|
export { LogoVariant, type LogoProps } from './stories/types/logo';
|
|
19
22
|
export { TogglePosition, type ToggleProps } from './stories/types/toggle';
|
|
20
23
|
export { type HeaderProps } from './stories/types/header';
|
|
24
|
+
export { NavItemState, NavItemSize, type NavItemProps, } from './stories/types/nav-item';
|
|
25
|
+
export { CreditsCardSize, type CreditsCardProps, } from './stories/types/credits-card';
|
|
26
|
+
export { SidebarSize, type SidebarProps, type NavItemConfig, type NavSection, } from './stories/types/sidebar';
|
package/dist/index.js
CHANGED
|
@@ -9,6 +9,9 @@ export { ProgressIndicator } from './stories/ProgressIndicator';
|
|
|
9
9
|
export { Logo } from './stories/Logo';
|
|
10
10
|
export { Toggle } from './stories/Toggle';
|
|
11
11
|
export { Header } from './stories/Header';
|
|
12
|
+
export { NavItem } from './stories/NavItem';
|
|
13
|
+
export { CreditsCard } from './stories/CreditsCard';
|
|
14
|
+
export { Sidebar } from './stories/Sidebar';
|
|
12
15
|
// Button Types
|
|
13
16
|
export { ButtonSize, ButtonHierarchy, ButtonState, ButtonShape, ButtonDisplayMode, ButtonType, } from './stories/types/button';
|
|
14
17
|
// Badge Types
|
|
@@ -27,3 +30,9 @@ export { ProgressIndicatorMode, } from './stories/types/progress-indicator';
|
|
|
27
30
|
export { LogoVariant } from './stories/types/logo';
|
|
28
31
|
// Toggle Types
|
|
29
32
|
export { TogglePosition } from './stories/types/toggle';
|
|
33
|
+
// NavItem Types
|
|
34
|
+
export { NavItemState, NavItemSize, } from './stories/types/nav-item';
|
|
35
|
+
// Card Types
|
|
36
|
+
export { CreditsCardSize, } from './stories/types/credits-card';
|
|
37
|
+
// Sidebar Types
|
|
38
|
+
export { SidebarSize, } from './stories/types/sidebar';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import styled from '@emotion/styled';
|
|
3
|
+
import { CreditsCardSize } from './types/credits-card';
|
|
4
|
+
import { Typography } from './Typography';
|
|
5
|
+
import { TypographySize, TypographyWeight } from './types/typography';
|
|
6
|
+
import { Box } from '@mui/material';
|
|
7
|
+
import { MainButton } from './Button';
|
|
8
|
+
import { ButtonHierarchy, ButtonSize } from './types/button';
|
|
9
|
+
const StyledCard = styled.div `
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
gap: ${({ $size }) => ($size === CreditsCardSize.Collapsed ? '8px' : '16px')};
|
|
13
|
+
padding: ${({ $size }) => $size === CreditsCardSize.Collapsed ? '20px 16px' : '24px'};
|
|
14
|
+
background-color: var(--colors-light-background-bg-card-highlight);
|
|
15
|
+
border: 1px solid var(--colors-light-border-border-default);
|
|
16
|
+
border-radius: var(--spacing-tokens-size-in-px-spacing-spacing-md);
|
|
17
|
+
padding: ${({ $collapsed }) => $collapsed
|
|
18
|
+
? 'var(--spacing-tokens-size-in-px-spacing-spacing-md)'
|
|
19
|
+
: '8px var(--spacing-tokens-size-in-px-spacing-spacing-lg)'};
|
|
20
|
+
opacity: 1;
|
|
21
|
+
transition: all 0.2s ease;
|
|
22
|
+
width: 100%;
|
|
23
|
+
height: auto;
|
|
24
|
+
position: relative;
|
|
25
|
+
`;
|
|
26
|
+
const CreditRow = styled.div `
|
|
27
|
+
display: flex;
|
|
28
|
+
justify-content: ${({ $collapsed }) => $collapsed ? 'center' : 'space-between'};
|
|
29
|
+
align-items: center;
|
|
30
|
+
width: 100%;
|
|
31
|
+
`;
|
|
32
|
+
export const CreditsCard = ({ size = CreditsCardSize.Expanded, className, maxCredits = 1, usedCredits = 0, onUpgradeClick, creditInfoText = '1 Credit = 1 min video', }) => {
|
|
33
|
+
const isCollapsed = size === CreditsCardSize.Collapsed;
|
|
34
|
+
return (_jsxs(StyledCard, { "$collapsed": isCollapsed, "$size": size, className: className, children: [!isCollapsed &&
|
|
35
|
+
maxCredits !== undefined &&
|
|
36
|
+
usedCredits !== undefined && (_jsxs(_Fragment, { children: [_jsxs(CreditRow, { children: [_jsxs(Box, { gap: '2px', display: "flex", flexDirection: "row", children: [_jsx(Typography, { text: "My Credits: ", size: TypographySize.TextS, weight: TypographyWeight.Medium, color: "var(--colors-light-text-text-title)" }), _jsx(Typography, { text: `${usedCredits}/`, size: TypographySize.TextS, weight: TypographyWeight.Medium, color: "var(--colors-light-text-text-title)" }), _jsx(Typography, { text: `${maxCredits}`, size: TypographySize.TextS, weight: TypographyWeight.Medium, color: "var(--colors-light-text-text-paragraph)" })] }), _jsx(Box, { onClick: (e) => e.stopPropagation(), children: _jsx(MainButton, { text: "Upgrade", hierarchy: ButtonHierarchy.TetriaryColor, size: ButtonSize.md, style: { padding: '0' }, onClick: () => {
|
|
37
|
+
if (onUpgradeClick) {
|
|
38
|
+
onUpgradeClick();
|
|
39
|
+
}
|
|
40
|
+
} }) })] }), _jsx(CreditRow, { style: { justifyContent: 'end' }, children: _jsx(Box, { display: "flex", flexDirection: "row", children: _jsx(Typography, { text: creditInfoText, size: TypographySize.TextXS, weight: TypographyWeight.Regular, color: "var(--colors-light-text-text-subtle)" }) }) })] })), isCollapsed && maxCredits !== undefined && usedCredits !== undefined && (_jsxs(_Fragment, { children: [_jsx(CreditRow, { "$collapsed": true, children: _jsxs(Box, { display: "flex", flexDirection: "row", gap: "2px", children: [_jsx(Typography, { text: `${usedCredits}/`, size: TypographySize.TextS, weight: TypographyWeight.Medium, color: "var(--colors-light-text-text-title)" }), _jsx(Typography, { text: `${maxCredits}`, size: TypographySize.TextS, weight: TypographyWeight.Medium, color: "var(--colors-light-text-text-paragraph)" })] }) }), _jsx(CreditRow, { "$collapsed": true, children: _jsx(Box, { onClick: (e) => e.stopPropagation(), children: _jsx(MainButton, { text: "Upgrade", hierarchy: ButtonHierarchy.TetriaryColor, size: ButtonSize.sm, style: { padding: '0' }, onClick: () => {
|
|
41
|
+
if (onUpgradeClick) {
|
|
42
|
+
onUpgradeClick();
|
|
43
|
+
}
|
|
44
|
+
} }) }) })] }))] }));
|
|
45
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { CreditsCard } from './CreditsCard';
|
|
3
|
+
declare const meta: Meta<typeof CreditsCard>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof CreditsCard>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Collapsed: Story;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { CreditsCard } from './CreditsCard';
|
|
2
|
+
import { CreditsCardSize } from './types/credits-card';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Design System/Components/CreditsCard',
|
|
5
|
+
component: CreditsCard,
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: 'centered',
|
|
8
|
+
},
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: {
|
|
11
|
+
size: {
|
|
12
|
+
control: 'select',
|
|
13
|
+
options: Object.values(CreditsCardSize),
|
|
14
|
+
},
|
|
15
|
+
maxCredits: { control: 'number' },
|
|
16
|
+
usedCredits: { control: 'number' },
|
|
17
|
+
creditInfoText: { control: 'text' },
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
export default meta;
|
|
21
|
+
export const Default = {
|
|
22
|
+
args: {
|
|
23
|
+
size: CreditsCardSize.Expanded,
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
export const Collapsed = {
|
|
27
|
+
args: {
|
|
28
|
+
...Default.args,
|
|
29
|
+
size: CreditsCardSize.Collapsed,
|
|
30
|
+
},
|
|
31
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import styled from '@emotion/styled';
|
|
3
|
+
import * as PhosphorIcons from '@phosphor-icons/react';
|
|
4
|
+
import { NavItemState, NavItemSize } from './types/nav-item';
|
|
5
|
+
import { Typography } from './Typography';
|
|
6
|
+
import { TypographySize, TypographyWeight } from './types/typography';
|
|
7
|
+
import { Badge } from './Bagde';
|
|
8
|
+
import { BadgeColor, BadgeSize } from './types/badge';
|
|
9
|
+
import { Box } from '@mui/material';
|
|
10
|
+
const getIconComponent = (iconName, props) => {
|
|
11
|
+
const Icon = PhosphorIcons[iconName];
|
|
12
|
+
return Icon ? _jsx(Icon, { ...props }) : null;
|
|
13
|
+
};
|
|
14
|
+
const StyledNavItem = styled.div `
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: row;
|
|
17
|
+
align-items: center;
|
|
18
|
+
gap: 12px;
|
|
19
|
+
padding: ${({ $size }) => $size === NavItemSize.Collapsed ? '0px 28px 0px 0px' : '0px 60px 0px 0px'};
|
|
20
|
+
border-radius: 8px;
|
|
21
|
+
cursor: ${({ $state }) => $state === NavItemState.Disabled ? 'not-allowed' : 'pointer'};
|
|
22
|
+
opacity: ${({ $state }) => ($state === NavItemState.Disabled ? 0.5 : 1)};
|
|
23
|
+
transition: color 0.2s ease;
|
|
24
|
+
justify-content: ${({ $size }) => $size === NavItemSize.Collapsed ? 'center' : 'flex-start'};
|
|
25
|
+
|
|
26
|
+
&:hover {
|
|
27
|
+
.nav-item-icon {
|
|
28
|
+
color: ${({ $state }) => $state === NavItemState.Disabled
|
|
29
|
+
? 'var(--primitives-desktop-primary-gray-500)'
|
|
30
|
+
: 'var(--colors-light-background-bg-brand-hover)'} !important;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.nav-item-text {
|
|
34
|
+
color: ${({ $state }) => $state === NavItemState.Disabled
|
|
35
|
+
? 'var(--primitives-desktop-primary-gray-500)'
|
|
36
|
+
: 'var(--colors-light-background-bg-brand-hover)'} !important;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
`;
|
|
40
|
+
// Custom styled span to handle icon color changes
|
|
41
|
+
const IconWrapper = styled.span `
|
|
42
|
+
display: inline-flex;
|
|
43
|
+
color: ${({ $state }) => $state === NavItemState.Active
|
|
44
|
+
? 'var(--colors-light-background-bg-brand)'
|
|
45
|
+
: 'var(--primitives-desktop-primary-gray-500)'};
|
|
46
|
+
transition: color 0.2s ease;
|
|
47
|
+
`;
|
|
48
|
+
export const NavItem = ({ text, icon, state = NavItemState.Default, size = NavItemSize.Expanded, showBadge = false, onClick, className, }) => {
|
|
49
|
+
const handleClick = () => {
|
|
50
|
+
if (state !== NavItemState.Disabled && onClick) {
|
|
51
|
+
onClick();
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
const isCollapsed = size === NavItemSize.Collapsed;
|
|
55
|
+
return (_jsxs(StyledNavItem, { "$state": state, "$size": size, onClick: handleClick, className: className, title: isCollapsed ? text : undefined, children: [_jsx("svg", { width: "5", height: "36", viewBox: "0 0 5 36", fill: state === NavItemState.Active
|
|
56
|
+
? 'var(--colors-light-background-bg-brand)'
|
|
57
|
+
: 'transparent', xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "M0 0C2.76142 0 5 2.23858 5 5V31C5 33.7614 2.76142 36 0 36V0Z" }) }), _jsxs(Box, { display: "flex", alignItems: 'center', gap: '8px', children: [_jsx(IconWrapper, { className: "nav-item-icon", "$state": state, children: getIconComponent(icon, {
|
|
58
|
+
size: 20,
|
|
59
|
+
}) }), !isCollapsed && (_jsx("span", { className: "nav-item-text", children: _jsx(Typography, { text: text, size: TypographySize.TextS, weight: state === NavItemState.Active
|
|
60
|
+
? TypographyWeight.Medium
|
|
61
|
+
: TypographyWeight.Regular, className: "nav-item-text", color: state === NavItemState.Active
|
|
62
|
+
? 'var(--colors-light-background-bg-brand)'
|
|
63
|
+
: 'var(--colors-light-text-text-subtle)' }) })), showBadge && (_jsx(Badge, { size: BadgeSize.xs, icon: "ClockCountdown", text: isCollapsed ? '' : 'Coming Soon', color: BadgeColor.Default }))] })] }));
|
|
64
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { NavItem } from './NavItem';
|
|
3
|
+
declare const meta: Meta<typeof NavItem>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof NavItem>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Active: Story;
|
|
8
|
+
export declare const Disabled: Story;
|
|
9
|
+
export declare const Expanded: Story;
|
|
10
|
+
export declare const Collapsed: Story;
|
|
11
|
+
export declare const WithComingSoonBadge: Story;
|
|
12
|
+
export declare const SidebarExpanded: Story;
|
|
13
|
+
export declare const SidebarCollapsed: Story;
|
|
14
|
+
export declare const DifferentIcons: Story;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { NavItem } from './NavItem';
|
|
3
|
+
import { NavItemState, NavItemSize } from './types/nav-item';
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Design System/Components/NavItem',
|
|
6
|
+
component: NavItem,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: 'centered',
|
|
9
|
+
},
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
argTypes: {
|
|
12
|
+
text: { control: 'text' },
|
|
13
|
+
icon: { control: 'text' },
|
|
14
|
+
state: {
|
|
15
|
+
control: 'select',
|
|
16
|
+
options: Object.values(NavItemState),
|
|
17
|
+
},
|
|
18
|
+
size: {
|
|
19
|
+
control: 'select',
|
|
20
|
+
options: Object.values(NavItemSize),
|
|
21
|
+
},
|
|
22
|
+
showBadge: { control: 'boolean' },
|
|
23
|
+
onClick: { action: 'clicked' },
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
export default meta;
|
|
27
|
+
export const Default = {
|
|
28
|
+
args: {
|
|
29
|
+
text: 'Navigation Item',
|
|
30
|
+
icon: 'House',
|
|
31
|
+
state: NavItemState.Default,
|
|
32
|
+
size: NavItemSize.Expanded,
|
|
33
|
+
showBadge: false,
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
export const Active = {
|
|
37
|
+
args: {
|
|
38
|
+
text: 'Active Item',
|
|
39
|
+
icon: 'House',
|
|
40
|
+
state: NavItemState.Active,
|
|
41
|
+
size: NavItemSize.Expanded,
|
|
42
|
+
showBadge: false,
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
export const Disabled = {
|
|
46
|
+
args: {
|
|
47
|
+
text: 'Disabled Item',
|
|
48
|
+
icon: 'House',
|
|
49
|
+
state: NavItemState.Disabled,
|
|
50
|
+
size: NavItemSize.Expanded,
|
|
51
|
+
showBadge: false,
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
export const Expanded = {
|
|
55
|
+
args: {
|
|
56
|
+
text: 'Expanded Item',
|
|
57
|
+
icon: 'House',
|
|
58
|
+
size: NavItemSize.Expanded,
|
|
59
|
+
showBadge: false,
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
export const Collapsed = {
|
|
63
|
+
args: {
|
|
64
|
+
text: 'Collapsed Item',
|
|
65
|
+
icon: 'House',
|
|
66
|
+
size: NavItemSize.Collapsed,
|
|
67
|
+
showBadge: false,
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
export const WithComingSoonBadge = {
|
|
71
|
+
args: {
|
|
72
|
+
text: 'New Feature',
|
|
73
|
+
icon: 'Sparkle',
|
|
74
|
+
showBadge: true,
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
export const SidebarExpanded = {
|
|
78
|
+
render: () => (_jsxs("div", { style: {
|
|
79
|
+
display: 'flex',
|
|
80
|
+
flexDirection: 'column',
|
|
81
|
+
gap: '8px',
|
|
82
|
+
padding: '16px',
|
|
83
|
+
backgroundColor: 'var(--colors-light-background-bg-white)',
|
|
84
|
+
borderRadius: '8px',
|
|
85
|
+
boxShadow: '0 2px 8px rgba(0, 0, 0, 0.1)',
|
|
86
|
+
}, children: [_jsx(NavItem, { text: "Home", icon: "House", size: NavItemSize.Expanded, state: NavItemState.Active }), _jsx(NavItem, { text: "Settings", icon: "Gear", size: NavItemSize.Expanded }), _jsx(NavItem, { text: "Notifications", icon: "Bell", size: NavItemSize.Expanded }), _jsx(NavItem, { text: "Messages", icon: "ChatText", size: NavItemSize.Expanded }), _jsx(NavItem, { text: "Profile", icon: "User", size: NavItemSize.Expanded }), _jsx(NavItem, { text: "Analytics", icon: "ChartBar", size: NavItemSize.Expanded, showBadge: true, state: NavItemState.Disabled })] })),
|
|
87
|
+
};
|
|
88
|
+
export const SidebarCollapsed = {
|
|
89
|
+
render: () => (_jsxs("div", { style: {
|
|
90
|
+
display: 'flex',
|
|
91
|
+
flexDirection: 'column',
|
|
92
|
+
gap: '8px',
|
|
93
|
+
backgroundColor: 'var(--colors-light-background-bg-white)',
|
|
94
|
+
borderRadius: '8px',
|
|
95
|
+
boxShadow: '0 2px 8px rgba(0, 0, 0, 0.1)',
|
|
96
|
+
}, children: [_jsx(NavItem, { text: "Home", icon: "House", size: NavItemSize.Collapsed, state: NavItemState.Active }), _jsx(NavItem, { text: "Settings", icon: "Gear", size: NavItemSize.Collapsed }), _jsx(NavItem, { text: "Notifications", icon: "Bell", size: NavItemSize.Collapsed }), _jsx(NavItem, { text: "Messages", icon: "ChatText", size: NavItemSize.Collapsed }), _jsx(NavItem, { text: "Profile", icon: "User", size: NavItemSize.Collapsed }), _jsx(NavItem, { text: "Analytics", icon: "ChartBar", state: NavItemState.Disabled, size: NavItemSize.Collapsed })] })),
|
|
97
|
+
};
|
|
98
|
+
export const DifferentIcons = {
|
|
99
|
+
render: () => (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '8px' }, children: [_jsx(NavItem, { text: "Home", icon: "House" }), _jsx(NavItem, { text: "Settings", icon: "Gear" }), _jsx(NavItem, { text: "Notifications", icon: "Bell" }), _jsx(NavItem, { text: "Messages", icon: "ChatText" }), _jsx(NavItem, { text: "Profile", icon: "User" }), _jsx(NavItem, { text: "Analytics", icon: "ChartBar", showBadge: true })] })),
|
|
100
|
+
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import styled from '@emotion/styled';
|
|
4
|
+
import { Box } from '@mui/material';
|
|
5
|
+
import { NavItem } from './NavItem';
|
|
6
|
+
import { Logo } from './Logo';
|
|
7
|
+
import { CreditsCard } from './CreditsCard';
|
|
8
|
+
import { SidebarSize } from './types/sidebar';
|
|
9
|
+
import { NavItemState, NavItemSize } from './types/nav-item';
|
|
10
|
+
import { LogoVariant } from './types/logo';
|
|
11
|
+
import { CreditsCardSize } from './types/credits-card';
|
|
12
|
+
import { Typography } from './Typography';
|
|
13
|
+
import { TypographySize, TypographyWeight } from './types/typography';
|
|
14
|
+
import { MainButton } from './Button';
|
|
15
|
+
import { ButtonDisplayMode, ButtonHierarchy, ButtonShape, } from './types/button';
|
|
16
|
+
import { ButtonSize } from './types/button';
|
|
17
|
+
const StyledSidebar = styled.div `
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
background-color: var(--colors-light-background-bg-surface);
|
|
21
|
+
border-right: 1px solid var(--colors-light-border-border-default);
|
|
22
|
+
height: 100vh;
|
|
23
|
+
width: 100%;
|
|
24
|
+
transition: width 0.3s ease;
|
|
25
|
+
overflow-x: hidden;
|
|
26
|
+
overflow-y: scroll;
|
|
27
|
+
position: relative;
|
|
28
|
+
padding: 24px 0;
|
|
29
|
+
`;
|
|
30
|
+
const LogoContainer = styled.div `
|
|
31
|
+
display: flex;
|
|
32
|
+
justify-content: ${({ $size }) => $size === SidebarSize.Expanded ? 'flex-start' : 'center'};
|
|
33
|
+
padding: ${({ $size }) => ($size === SidebarSize.Expanded ? '0 24px' : '0')};
|
|
34
|
+
margin-bottom: 32px;
|
|
35
|
+
height: 38px;
|
|
36
|
+
position: relative;
|
|
37
|
+
`;
|
|
38
|
+
const ToggleButtonWrapper = styled.div `
|
|
39
|
+
position: absolute;
|
|
40
|
+
top: 0.2rem;
|
|
41
|
+
right: -1rem;
|
|
42
|
+
z-index: 10;
|
|
43
|
+
transform: translateZ(0);
|
|
44
|
+
`;
|
|
45
|
+
const NavItemsContainer = styled.div `
|
|
46
|
+
display: flex;
|
|
47
|
+
flex-direction: column;
|
|
48
|
+
gap: 8px;
|
|
49
|
+
padding: 0 16px;
|
|
50
|
+
flex: 1;
|
|
51
|
+
`;
|
|
52
|
+
const NavSection = styled.div `
|
|
53
|
+
display: flex;
|
|
54
|
+
flex-direction: column;
|
|
55
|
+
gap: 8px;
|
|
56
|
+
`;
|
|
57
|
+
const SectionTitle = styled.div `
|
|
58
|
+
color: var(--colors-light-text-text-subtle);
|
|
59
|
+
opacity: 0.5;
|
|
60
|
+
padding: ${({ $size }) => $size === SidebarSize.Expanded ? '8px 12px' : '8px 0'};
|
|
61
|
+
display: ${({ $size }) => $size === SidebarSize.Collapsed ? 'none' : 'block'};
|
|
62
|
+
`;
|
|
63
|
+
const Separator = styled.div `
|
|
64
|
+
height: 0.31px;
|
|
65
|
+
background-color: var(--primitives-desktop-primary-brand-violet-950);
|
|
66
|
+
padding: 0 28px;
|
|
67
|
+
margin: 10px;
|
|
68
|
+
opacity: 0.05;
|
|
69
|
+
`;
|
|
70
|
+
const BottomContainer = styled.div `
|
|
71
|
+
padding: 0 16px;
|
|
72
|
+
margin-top: 16px;
|
|
73
|
+
`;
|
|
74
|
+
// Wrapper component to handle links
|
|
75
|
+
const NavItemWrapper = ({ item, isCollapsed, }) => {
|
|
76
|
+
const handleClick = () => {
|
|
77
|
+
if (item.link) {
|
|
78
|
+
window.location.href = item.link;
|
|
79
|
+
}
|
|
80
|
+
else if (item.onClick) {
|
|
81
|
+
item.onClick();
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
return (_jsx(NavItem, { text: item.text, icon: item.icon, state: item.state || NavItemState.Default, size: isCollapsed ? NavItemSize.Collapsed : NavItemSize.Expanded, showBadge: item.showBadge, onClick: handleClick }));
|
|
85
|
+
};
|
|
86
|
+
export const Sidebar = ({ size = SidebarSize.Expanded, className = '', navSections, bottomNavItems = [], credits, onToggle, logoProps = {}, }) => {
|
|
87
|
+
const [sidebarSize, setSidebarSize] = useState(size);
|
|
88
|
+
const handleToggle = () => {
|
|
89
|
+
const newSize = sidebarSize === SidebarSize.Expanded
|
|
90
|
+
? SidebarSize.Collapsed
|
|
91
|
+
: SidebarSize.Expanded;
|
|
92
|
+
setSidebarSize(newSize);
|
|
93
|
+
if (onToggle) {
|
|
94
|
+
onToggle(newSize);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
const isCollapsed = sidebarSize === SidebarSize.Collapsed;
|
|
98
|
+
return (_jsxs(StyledSidebar, { "$size": sidebarSize, className: className, children: [_jsxs(LogoContainer, { "$size": sidebarSize, children: [_jsx(Logo, { variant: isCollapsed ? LogoVariant.Icon : LogoVariant.Horizontal, color: logoProps.color, gradient: logoProps.gradient }), _jsx(ToggleButtonWrapper, { children: isCollapsed ? (_jsx(MainButton, { text: "Expand", size: ButtonSize.xxs, displayIconMode: ButtonDisplayMode.Only, displayIcon: "CaretRight", onClick: handleToggle, shape: ButtonShape.Circle, hierarchy: ButtonHierarchy.Tetriary, style: {
|
|
99
|
+
boxShadow: '2px 4px 8px 0px #1D142814',
|
|
100
|
+
} })) : (_jsx(MainButton, { size: ButtonSize.xxs, text: "Collapse", hierarchy: ButtonHierarchy.Tetriary, displayIconMode: ButtonDisplayMode.Only, displayIcon: "CaretLeft", onClick: handleToggle, style: {
|
|
101
|
+
boxShadow: '2px 4px 8px 0px #1D142814',
|
|
102
|
+
}, shape: ButtonShape.Circle })) })] }), _jsx(NavItemsContainer, { children: navSections.map((section, sectionIndex) => (_jsxs(React.Fragment, { children: [_jsxs(NavSection, { children: [section.title && (_jsx(SectionTitle, { "$size": sidebarSize, children: _jsx(Typography, { text: section.title, size: TypographySize.TextS, weight: TypographyWeight.Regular, color: "var(--primitives-desktop-primary-gray-700)" }) })), section.items.map((item, itemIndex) => (_jsx(NavItemWrapper, { item: item, isCollapsed: isCollapsed }, `${item.text}-${itemIndex}`)))] }), section.showSeparator && sectionIndex < navSections.length - 1 && (_jsx(Separator, {}))] }, `section-${sectionIndex}`))) }), _jsx(BottomContainer, { children: _jsxs(Box, { display: "flex", flexDirection: "column", gap: "16px", children: [credits && (_jsx(CreditsCard, { size: isCollapsed
|
|
103
|
+
? CreditsCardSize.Collapsed
|
|
104
|
+
: CreditsCardSize.Expanded, maxCredits: credits.maxCredits, usedCredits: credits.usedCredits, creditInfoText: credits.creditInfoText, onUpgradeClick: credits.onUpgradeClick })), bottomNavItems.map((item, index) => (_jsx(NavItemWrapper, { item: item, isCollapsed: isCollapsed }, `bottom-${item.text}-${index}`)))] }) })] }));
|
|
105
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Sidebar } from './Sidebar';
|
|
3
|
+
declare const meta: Meta<typeof Sidebar>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Sidebar>;
|
|
6
|
+
export declare const Expanded: Story;
|
|
7
|
+
export declare const Collapsed: Story;
|
|
8
|
+
export declare const WithoutCredits: Story;
|
|
9
|
+
export declare const CustomSections: Story;
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import { Sidebar } from './Sidebar';
|
|
2
|
+
import { SidebarSize } from './types/sidebar';
|
|
3
|
+
import { NavItemState } from './types/nav-item';
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Design System/Components/Sidebar',
|
|
6
|
+
component: Sidebar,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: 'fullscreen',
|
|
9
|
+
},
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
argTypes: {
|
|
12
|
+
size: {
|
|
13
|
+
control: 'select',
|
|
14
|
+
options: Object.values(SidebarSize),
|
|
15
|
+
},
|
|
16
|
+
logoProps: {
|
|
17
|
+
control: 'object',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
export default meta;
|
|
22
|
+
const defaultNavSections = [
|
|
23
|
+
{
|
|
24
|
+
title: '',
|
|
25
|
+
items: [
|
|
26
|
+
{
|
|
27
|
+
text: 'Home',
|
|
28
|
+
icon: 'House',
|
|
29
|
+
state: NavItemState.Default,
|
|
30
|
+
link: '#/home',
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
showSeparator: true,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
title: '',
|
|
37
|
+
items: [
|
|
38
|
+
{
|
|
39
|
+
text: 'Avatars',
|
|
40
|
+
icon: 'UserFocus',
|
|
41
|
+
state: NavItemState.Default,
|
|
42
|
+
link: '#/avatars',
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
showSeparator: true,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
title: 'Videos',
|
|
49
|
+
items: [
|
|
50
|
+
{
|
|
51
|
+
text: 'Text-to-Video',
|
|
52
|
+
icon: 'VideoCamera',
|
|
53
|
+
state: NavItemState.Active,
|
|
54
|
+
link: '#/text-to-video',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
text: 'Outreach Campaigns',
|
|
58
|
+
icon: 'UsersFour',
|
|
59
|
+
state: NavItemState.Default,
|
|
60
|
+
link: '#/outreach-campaigns',
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
showSeparator: true,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
title: 'Conversational Agents',
|
|
67
|
+
items: [
|
|
68
|
+
{
|
|
69
|
+
text: 'My Agents',
|
|
70
|
+
icon: 'Headset',
|
|
71
|
+
state: NavItemState.Default,
|
|
72
|
+
link: '#/my-agents',
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
text: 'Knowledge Base',
|
|
76
|
+
icon: 'Book',
|
|
77
|
+
state: NavItemState.Default,
|
|
78
|
+
link: '#/knowledge-base',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
text: 'Conversations',
|
|
82
|
+
icon: 'ChatCircle',
|
|
83
|
+
state: NavItemState.Default,
|
|
84
|
+
link: '#/conversations',
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
showSeparator: true,
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
title: 'Analytics',
|
|
91
|
+
items: [
|
|
92
|
+
{
|
|
93
|
+
text: 'Analytics',
|
|
94
|
+
icon: 'ChartLine',
|
|
95
|
+
state: NavItemState.Default,
|
|
96
|
+
showBadge: true,
|
|
97
|
+
link: '#/analytics',
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
},
|
|
101
|
+
];
|
|
102
|
+
const defaultBottomNavItems = [
|
|
103
|
+
{
|
|
104
|
+
text: 'My account',
|
|
105
|
+
icon: 'Gear',
|
|
106
|
+
link: '#/account',
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
text: 'Feedback',
|
|
110
|
+
icon: 'ChatCircle',
|
|
111
|
+
link: '#/feedback',
|
|
112
|
+
},
|
|
113
|
+
];
|
|
114
|
+
export const Expanded = {
|
|
115
|
+
args: {
|
|
116
|
+
size: SidebarSize.Expanded,
|
|
117
|
+
navSections: defaultNavSections,
|
|
118
|
+
bottomNavItems: defaultBottomNavItems,
|
|
119
|
+
credits: {
|
|
120
|
+
maxCredits: 50,
|
|
121
|
+
usedCredits: 10,
|
|
122
|
+
creditInfoText: '1 Credit = 1 min video',
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
export const Collapsed = {
|
|
127
|
+
args: {
|
|
128
|
+
size: SidebarSize.Collapsed,
|
|
129
|
+
navSections: defaultNavSections,
|
|
130
|
+
bottomNavItems: defaultBottomNavItems,
|
|
131
|
+
credits: {
|
|
132
|
+
maxCredits: 50,
|
|
133
|
+
usedCredits: 10,
|
|
134
|
+
creditInfoText: '1 Credit = 1 min video',
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
export const WithoutCredits = {
|
|
139
|
+
args: {
|
|
140
|
+
size: SidebarSize.Expanded,
|
|
141
|
+
navSections: defaultNavSections,
|
|
142
|
+
bottomNavItems: defaultBottomNavItems,
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
export const CustomSections = {
|
|
146
|
+
args: {
|
|
147
|
+
size: SidebarSize.Expanded,
|
|
148
|
+
navSections: [
|
|
149
|
+
{
|
|
150
|
+
title: 'Main Navigation',
|
|
151
|
+
items: [
|
|
152
|
+
{
|
|
153
|
+
text: 'Dashboard',
|
|
154
|
+
icon: 'ChartPie',
|
|
155
|
+
state: NavItemState.Default,
|
|
156
|
+
link: '#/dashboard',
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
text: 'Projects',
|
|
160
|
+
icon: 'FolderOpen',
|
|
161
|
+
state: NavItemState.Active,
|
|
162
|
+
link: '#/projects',
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
text: 'Calendar',
|
|
166
|
+
icon: 'Calendar',
|
|
167
|
+
state: NavItemState.Default,
|
|
168
|
+
link: '#/calendar',
|
|
169
|
+
},
|
|
170
|
+
],
|
|
171
|
+
showSeparator: true,
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
title: 'Content',
|
|
175
|
+
items: [
|
|
176
|
+
{
|
|
177
|
+
text: 'Media Library',
|
|
178
|
+
icon: 'Image',
|
|
179
|
+
state: NavItemState.Default,
|
|
180
|
+
link: '#/media',
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
text: 'Documents',
|
|
184
|
+
icon: 'File',
|
|
185
|
+
state: NavItemState.Default,
|
|
186
|
+
link: '#/documents',
|
|
187
|
+
},
|
|
188
|
+
],
|
|
189
|
+
showSeparator: true,
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
title: 'Settings',
|
|
193
|
+
items: [
|
|
194
|
+
{
|
|
195
|
+
text: 'Account Settings',
|
|
196
|
+
icon: 'Gear',
|
|
197
|
+
state: NavItemState.Default,
|
|
198
|
+
link: '#/settings/account',
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
text: 'Team Members',
|
|
202
|
+
icon: 'Users',
|
|
203
|
+
state: NavItemState.Default,
|
|
204
|
+
link: '#/settings/team',
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
text: 'Notifications',
|
|
208
|
+
icon: 'Bell',
|
|
209
|
+
state: NavItemState.Default,
|
|
210
|
+
showBadge: true,
|
|
211
|
+
link: '#/settings/notifications',
|
|
212
|
+
},
|
|
213
|
+
],
|
|
214
|
+
},
|
|
215
|
+
],
|
|
216
|
+
bottomNavItems: [
|
|
217
|
+
{
|
|
218
|
+
text: 'Help Center',
|
|
219
|
+
icon: 'Question',
|
|
220
|
+
link: '#/help',
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
text: 'Log Out',
|
|
224
|
+
icon: 'SignOut',
|
|
225
|
+
onClick: () => alert('Logging out...'),
|
|
226
|
+
},
|
|
227
|
+
],
|
|
228
|
+
credits: {
|
|
229
|
+
maxCredits: 100,
|
|
230
|
+
usedCredits: 45,
|
|
231
|
+
creditInfoText: '1 Credit = 1 resource',
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export declare enum CreditsCardSize {
|
|
2
|
+
Expanded = "expanded",
|
|
3
|
+
Collapsed = "collapsed"
|
|
4
|
+
}
|
|
5
|
+
export declare enum CreditsCardState {
|
|
6
|
+
Default = "default",
|
|
7
|
+
Active = "active",
|
|
8
|
+
Disabled = "disabled"
|
|
9
|
+
}
|
|
10
|
+
export interface CreditsCardProps {
|
|
11
|
+
/**
|
|
12
|
+
* The size of the card
|
|
13
|
+
*/
|
|
14
|
+
size?: CreditsCardSize;
|
|
15
|
+
/**
|
|
16
|
+
* Optional className for additional styling
|
|
17
|
+
*/
|
|
18
|
+
className?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Maximum available credits
|
|
21
|
+
*/
|
|
22
|
+
maxCredits?: number;
|
|
23
|
+
/**
|
|
24
|
+
* Currently used credits
|
|
25
|
+
*/
|
|
26
|
+
usedCredits?: number;
|
|
27
|
+
/**
|
|
28
|
+
* Function to handle upgrade button click
|
|
29
|
+
*/
|
|
30
|
+
onUpgradeClick?: () => void;
|
|
31
|
+
/**
|
|
32
|
+
* Text explaining credit usage (e.g., "1 Credit = 1 min video")
|
|
33
|
+
*/
|
|
34
|
+
creditInfoText?: string;
|
|
35
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export var CreditsCardSize;
|
|
2
|
+
(function (CreditsCardSize) {
|
|
3
|
+
CreditsCardSize["Expanded"] = "expanded";
|
|
4
|
+
CreditsCardSize["Collapsed"] = "collapsed";
|
|
5
|
+
})(CreditsCardSize || (CreditsCardSize = {}));
|
|
6
|
+
export var CreditsCardState;
|
|
7
|
+
(function (CreditsCardState) {
|
|
8
|
+
CreditsCardState["Default"] = "default";
|
|
9
|
+
CreditsCardState["Active"] = "active";
|
|
10
|
+
CreditsCardState["Disabled"] = "disabled";
|
|
11
|
+
})(CreditsCardState || (CreditsCardState = {}));
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export declare enum NavItemState {
|
|
2
|
+
Default = "default",
|
|
3
|
+
Active = "active",
|
|
4
|
+
Disabled = "disabled"
|
|
5
|
+
}
|
|
6
|
+
export declare enum NavItemSize {
|
|
7
|
+
Expanded = "expanded",
|
|
8
|
+
Collapsed = "collapsed"
|
|
9
|
+
}
|
|
10
|
+
export interface NavItemProps {
|
|
11
|
+
/**
|
|
12
|
+
* The text to display in the navigation item
|
|
13
|
+
*/
|
|
14
|
+
text: string;
|
|
15
|
+
/**
|
|
16
|
+
* The icon to display before the text
|
|
17
|
+
* Uses Phosphor Icons
|
|
18
|
+
*/
|
|
19
|
+
icon: string;
|
|
20
|
+
/**
|
|
21
|
+
* The current state of the navigation item
|
|
22
|
+
*/
|
|
23
|
+
state?: NavItemState;
|
|
24
|
+
/**
|
|
25
|
+
* The size of the navigation item
|
|
26
|
+
*/
|
|
27
|
+
size?: NavItemSize;
|
|
28
|
+
/**
|
|
29
|
+
* Whether to show a "Coming Soon" badge
|
|
30
|
+
*/
|
|
31
|
+
showBadge?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Optional click handler
|
|
34
|
+
*/
|
|
35
|
+
onClick?: () => void;
|
|
36
|
+
/**
|
|
37
|
+
* Optional className for additional styling
|
|
38
|
+
*/
|
|
39
|
+
className?: string;
|
|
40
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export var NavItemState;
|
|
2
|
+
(function (NavItemState) {
|
|
3
|
+
NavItemState["Default"] = "default";
|
|
4
|
+
NavItemState["Active"] = "active";
|
|
5
|
+
NavItemState["Disabled"] = "disabled";
|
|
6
|
+
})(NavItemState || (NavItemState = {}));
|
|
7
|
+
export var NavItemSize;
|
|
8
|
+
(function (NavItemSize) {
|
|
9
|
+
NavItemSize["Expanded"] = "expanded";
|
|
10
|
+
NavItemSize["Collapsed"] = "collapsed";
|
|
11
|
+
})(NavItemSize || (NavItemSize = {}));
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export declare enum SidebarSize {
|
|
2
|
+
Expanded = "expanded",
|
|
3
|
+
Collapsed = "collapsed"
|
|
4
|
+
}
|
|
5
|
+
export interface NavItemConfig {
|
|
6
|
+
/**
|
|
7
|
+
* The text to display in the navigation item
|
|
8
|
+
*/
|
|
9
|
+
text: string;
|
|
10
|
+
/**
|
|
11
|
+
* The icon to display before the text (Phosphor icon name)
|
|
12
|
+
*/
|
|
13
|
+
icon: string;
|
|
14
|
+
/**
|
|
15
|
+
* The current state of the navigation item
|
|
16
|
+
*/
|
|
17
|
+
state?: 'default' | 'active' | 'disabled';
|
|
18
|
+
/**
|
|
19
|
+
* Whether to show a badge (e.g., "Coming Soon")
|
|
20
|
+
*/
|
|
21
|
+
showBadge?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Optional click handler
|
|
24
|
+
*/
|
|
25
|
+
onClick?: () => void;
|
|
26
|
+
/**
|
|
27
|
+
* Optional link URL for the navigation item
|
|
28
|
+
*/
|
|
29
|
+
link?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface NavSection {
|
|
32
|
+
/**
|
|
33
|
+
* The title of the section
|
|
34
|
+
*/
|
|
35
|
+
title: string;
|
|
36
|
+
/**
|
|
37
|
+
* The navigation items in this section
|
|
38
|
+
*/
|
|
39
|
+
items: NavItemConfig[];
|
|
40
|
+
/**
|
|
41
|
+
* Whether to show a separator after this section
|
|
42
|
+
*/
|
|
43
|
+
showSeparator?: boolean;
|
|
44
|
+
}
|
|
45
|
+
export interface SidebarProps {
|
|
46
|
+
/**
|
|
47
|
+
* The size of the sidebar
|
|
48
|
+
*/
|
|
49
|
+
size?: SidebarSize;
|
|
50
|
+
/**
|
|
51
|
+
* Optional className for additional styling
|
|
52
|
+
*/
|
|
53
|
+
className?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Navigation sections to display in the sidebar
|
|
56
|
+
*/
|
|
57
|
+
navSections: NavSection[];
|
|
58
|
+
/**
|
|
59
|
+
* Bottom navigation items (e.g., account, feedback)
|
|
60
|
+
*/
|
|
61
|
+
bottomNavItems?: NavItemConfig[];
|
|
62
|
+
/**
|
|
63
|
+
* Credits information
|
|
64
|
+
*/
|
|
65
|
+
credits?: {
|
|
66
|
+
maxCredits: number;
|
|
67
|
+
usedCredits: number;
|
|
68
|
+
creditInfoText?: string;
|
|
69
|
+
onUpgradeClick?: () => void;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Optional callback when sidebar is toggled
|
|
73
|
+
*/
|
|
74
|
+
onToggle?: (size: SidebarSize) => void;
|
|
75
|
+
/**
|
|
76
|
+
* Optional logo props
|
|
77
|
+
*/
|
|
78
|
+
logoProps?: {
|
|
79
|
+
gradient?: string;
|
|
80
|
+
color?: string;
|
|
81
|
+
};
|
|
82
|
+
}
|