@licklist/design 0.78.21 → 0.78.26
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/assets/Trend-Down.svg +3 -0
- package/dist/assets/Trend-Up.svg +3 -0
- package/dist/auth/Authorizer.d.ts.map +1 -1
- package/dist/auth/Authorizer.js +47 -12
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/v2/components/EntityHeader/EntityHeader.d.ts +13 -0
- package/dist/v2/components/EntityHeader/EntityHeader.d.ts.map +1 -0
- package/dist/v2/components/EntityHeader/EntityHeader.js +85 -0
- package/dist/v2/components/EntityHeader/EntityHeader.scss.js +6 -0
- package/dist/v2/components/EntityHeader/index.d.ts +2 -0
- package/dist/v2/components/EntityHeader/index.d.ts.map +1 -0
- package/dist/v2/components/NPSScore/NPSScore.d.ts +18 -0
- package/dist/v2/components/NPSScore/NPSScore.d.ts.map +1 -0
- package/dist/v2/components/NPSScore/index.d.ts +3 -0
- package/dist/v2/components/NPSScore/index.d.ts.map +1 -0
- package/dist/v2/components/Select/Select.d.ts +10 -0
- package/dist/v2/components/Select/Select.d.ts.map +1 -0
- package/dist/v2/components/Select/index.d.ts +3 -0
- package/dist/v2/components/Select/index.d.ts.map +1 -0
- package/dist/v2/components/Tooltip/Tooltip.d.ts +21 -0
- package/dist/v2/components/Tooltip/Tooltip.d.ts.map +1 -0
- package/dist/v2/components/Tooltip/Tooltip.js +103 -0
- package/dist/v2/components/Tooltip/Tooltip.scss.js +6 -0
- package/dist/v2/components/Tooltip/index.d.ts +2 -0
- package/dist/v2/components/Tooltip/index.d.ts.map +1 -0
- package/dist/v2/components/UserAvatar/UserAvatar.d.ts +12 -0
- package/dist/v2/components/UserAvatar/UserAvatar.d.ts.map +1 -0
- package/dist/v2/components/UserAvatar/UserAvatar.js +77 -0
- package/dist/v2/components/UserAvatar/UserAvatar.scss.js +6 -0
- package/dist/v2/components/UserAvatar/index.d.ts +2 -0
- package/dist/v2/components/UserAvatar/index.d.ts.map +1 -0
- package/dist/v2/components/UserPanel/UserPanel.d.ts +17 -0
- package/dist/v2/components/UserPanel/UserPanel.d.ts.map +1 -0
- package/dist/v2/components/UserPanel/UserPanel.js +144 -0
- package/dist/v2/components/UserPanel/UserPanel.scss.js +6 -0
- package/dist/v2/components/UserPanel/index.d.ts +3 -0
- package/dist/v2/components/UserPanel/index.d.ts.map +1 -0
- package/dist/v2/dashboard-analytics/blog-posts/Blog.d.ts +15 -0
- package/dist/v2/dashboard-analytics/blog-posts/Blog.d.ts.map +1 -0
- package/dist/v2/dashboard-analytics/blog-posts/index.d.ts +3 -0
- package/dist/v2/dashboard-analytics/blog-posts/index.d.ts.map +1 -0
- package/dist/v2/dashboard-analytics/chart/Chart.d.ts +21 -0
- package/dist/v2/dashboard-analytics/chart/Chart.d.ts.map +1 -0
- package/dist/v2/dashboard-analytics/chart/index.d.ts +3 -0
- package/dist/v2/dashboard-analytics/chart/index.d.ts.map +1 -0
- package/dist/v2/dashboard-analytics/dashboard/Dashboard.d.ts +57 -0
- package/dist/v2/dashboard-analytics/dashboard/Dashboard.d.ts.map +1 -0
- package/dist/v2/dashboard-analytics/dashboard/index.d.ts +3 -0
- package/dist/v2/dashboard-analytics/dashboard/index.d.ts.map +1 -0
- package/dist/v2/dashboard-analytics/index.d.ts +13 -0
- package/dist/v2/dashboard-analytics/index.d.ts.map +1 -0
- package/dist/v2/dashboard-analytics/metric-card/MetricCard.d.ts +17 -0
- package/dist/v2/dashboard-analytics/metric-card/MetricCard.d.ts.map +1 -0
- package/dist/v2/dashboard-analytics/metric-card/index.d.ts +3 -0
- package/dist/v2/dashboard-analytics/metric-card/index.d.ts.map +1 -0
- package/dist/v2/dashboard-analytics/venue-card/VenueCard.d.ts +12 -0
- package/dist/v2/dashboard-analytics/venue-card/VenueCard.d.ts.map +1 -0
- package/dist/v2/dashboard-analytics/venue-card/index.d.ts +3 -0
- package/dist/v2/dashboard-analytics/venue-card/index.d.ts.map +1 -0
- package/dist/v2/dashboard-analytics/venue-closed-card/VenueClosedCard.d.ts +25 -0
- package/dist/v2/dashboard-analytics/venue-closed-card/VenueClosedCard.d.ts.map +1 -0
- package/dist/v2/dashboard-analytics/venue-closed-card/index.d.ts +3 -0
- package/dist/v2/dashboard-analytics/venue-closed-card/index.d.ts.map +1 -0
- package/dist/v2/index.d.ts +11 -5
- package/dist/v2/index.d.ts.map +1 -1
- package/dist/v2/navigation/DashboardLayout/AdminSidebar.d.ts +10 -0
- package/dist/v2/navigation/DashboardLayout/AdminSidebar.d.ts.map +1 -0
- package/dist/v2/navigation/DashboardLayout/AdminSidebar.js +296 -0
- package/dist/v2/navigation/DashboardLayout/AdminSidebar.scss.js +6 -0
- package/dist/v2/navigation/DashboardLayout/DashboardFooter.d.ts +7 -0
- package/dist/v2/navigation/DashboardLayout/DashboardFooter.d.ts.map +1 -0
- package/dist/v2/navigation/DashboardLayout/DashboardFooter.js +34 -0
- package/dist/v2/navigation/DashboardLayout/DashboardFooter.scss.js +6 -0
- package/dist/v2/navigation/DashboardLayout/DashboardLayout.d.ts +42 -0
- package/dist/v2/navigation/DashboardLayout/DashboardLayout.d.ts.map +1 -0
- package/dist/v2/navigation/DashboardLayout/DashboardLayout.js +176 -0
- package/dist/v2/navigation/DashboardLayout/DashboardLayout.scss.js +6 -0
- package/dist/v2/navigation/DashboardLayout/ProviderSidebar.d.ts +35 -0
- package/dist/v2/navigation/DashboardLayout/ProviderSidebar.d.ts.map +1 -0
- package/dist/v2/navigation/DashboardLayout/ProviderSidebar.js +366 -0
- package/dist/v2/navigation/DashboardLayout/ProviderSidebar.scss.js +6 -0
- package/dist/v2/navigation/DashboardLayout/TopNavigation.d.ts +26 -0
- package/dist/v2/navigation/DashboardLayout/TopNavigation.d.ts.map +1 -0
- package/dist/v2/navigation/DashboardLayout/TopNavigation.js +360 -0
- package/dist/v2/navigation/DashboardLayout/TopNavigation.scss.js +6 -0
- package/dist/v2/navigation/DashboardLayout/assets/AdminLogo.png.js +3 -0
- package/dist/v2/navigation/DashboardLayout/assets/BookedLogo_Mark.png.js +3 -0
- package/dist/v2/navigation/DashboardLayout/index.d.ts +7 -0
- package/dist/v2/navigation/DashboardLayout/index.d.ts.map +1 -0
- package/package.json +5 -3
- package/src/assets/Trend-Down.svg +3 -0
- package/src/assets/Trend-Up.svg +3 -0
- package/src/auth/Authorizer.tsx +49 -20
- package/src/index.ts +2 -1
- package/src/v2/components/EntityHeader/EntityHeader.scss +133 -0
- package/src/v2/components/EntityHeader/EntityHeader.stories.tsx +103 -0
- package/src/v2/components/EntityHeader/EntityHeader.tsx +76 -0
- package/src/v2/components/EntityHeader/index.ts +1 -0
- package/src/v2/components/NPSScore/NPSScore.scss +330 -0
- package/src/v2/components/NPSScore/NPSScore.stories.tsx +29 -0
- package/src/v2/components/NPSScore/NPSScore.tsx +209 -0
- package/src/v2/components/NPSScore/index.ts +2 -0
- package/src/v2/components/Select/Select.scss +188 -0
- package/src/v2/components/Select/Select.stories.tsx +164 -0
- package/src/v2/components/Select/Select.tsx +56 -0
- package/src/v2/components/Select/index.ts +2 -0
- package/src/v2/components/Tooltip/Tooltip.scss +92 -0
- package/src/v2/components/Tooltip/Tooltip.stories.tsx +164 -0
- package/src/v2/components/Tooltip/Tooltip.tsx +64 -0
- package/src/v2/components/Tooltip/index.ts +8 -0
- package/src/v2/components/UserAvatar/UserAvatar.scss +62 -0
- package/src/v2/components/UserAvatar/UserAvatar.stories.tsx +94 -0
- package/src/v2/components/UserAvatar/UserAvatar.tsx +96 -0
- package/src/v2/components/UserAvatar/index.ts +1 -0
- package/src/v2/components/UserPanel/UserPanel.scss +195 -0
- package/src/v2/components/UserPanel/UserPanel.stories.tsx +66 -0
- package/src/v2/components/UserPanel/UserPanel.tsx +126 -0
- package/src/v2/components/UserPanel/index.ts +2 -0
- package/src/v2/dashboard-analytics/blog-posts/Blog.scss +92 -0
- package/src/v2/dashboard-analytics/blog-posts/Blog.stories.tsx +57 -0
- package/src/v2/dashboard-analytics/blog-posts/Blog.tsx +91 -0
- package/src/v2/dashboard-analytics/blog-posts/index.ts +2 -0
- package/src/v2/dashboard-analytics/chart/Chart.scss +424 -0
- package/src/v2/dashboard-analytics/chart/Chart.stories.tsx +157 -0
- package/src/v2/dashboard-analytics/chart/Chart.tsx +623 -0
- package/src/v2/dashboard-analytics/chart/index.ts +2 -0
- package/src/v2/dashboard-analytics/dashboard/Dashboard.scss +254 -0
- package/src/v2/dashboard-analytics/dashboard/Dashboard.stories.tsx +298 -0
- package/src/v2/dashboard-analytics/dashboard/Dashboard.tsx +248 -0
- package/src/v2/dashboard-analytics/dashboard/index.ts +2 -0
- package/src/v2/dashboard-analytics/index.ts +12 -0
- package/src/v2/dashboard-analytics/metric-card/MetricCard.scss +125 -0
- package/src/v2/dashboard-analytics/metric-card/MetricCard.stories.tsx +106 -0
- package/src/v2/dashboard-analytics/metric-card/MetricCard.tsx +72 -0
- package/src/v2/dashboard-analytics/metric-card/index.ts +2 -0
- package/src/v2/dashboard-analytics/venue-card/VenueCard.scss +112 -0
- package/src/v2/dashboard-analytics/venue-card/VenueCard.stories.tsx +40 -0
- package/src/v2/dashboard-analytics/venue-card/VenueCard.tsx +62 -0
- package/src/v2/dashboard-analytics/venue-card/index.ts +2 -0
- package/src/v2/dashboard-analytics/venue-closed-card/VenueClosedCard.scss +129 -0
- package/src/v2/dashboard-analytics/venue-closed-card/VenueClosedCard.stories.tsx +31 -0
- package/src/v2/dashboard-analytics/venue-closed-card/VenueClosedCard.tsx +61 -0
- package/src/v2/dashboard-analytics/venue-closed-card/index.ts +2 -0
- package/src/v2/design-system/colors/ColorSystem.scss +439 -0
- package/src/v2/design-system/colors/ColorSystem.stories.tsx +730 -0
- package/src/v2/design-system/typography/Typography.scss +295 -0
- package/src/v2/design-system/typography/Typography.stories.tsx +109 -0
- package/src/v2/index.ts +43 -7
- package/src/v2/navigation/DashboardLayout/AdminSidebar.scss +207 -0
- package/src/v2/navigation/DashboardLayout/AdminSidebar.tsx +171 -0
- package/src/v2/navigation/DashboardLayout/DashboardFooter.scss +30 -0
- package/src/v2/navigation/DashboardLayout/DashboardFooter.tsx +25 -0
- package/src/v2/navigation/DashboardLayout/DashboardLayout.scss +91 -0
- package/src/v2/navigation/DashboardLayout/DashboardLayout.stories.tsx +370 -0
- package/src/v2/navigation/DashboardLayout/DashboardLayout.tsx +233 -0
- package/src/v2/navigation/DashboardLayout/ProviderSidebar.scss +271 -0
- package/src/v2/navigation/DashboardLayout/ProviderSidebar.tsx +266 -0
- package/src/v2/navigation/DashboardLayout/Sidebar.stories.tsx +220 -0
- package/src/v2/navigation/DashboardLayout/TopNavigation.scss +206 -0
- package/src/v2/navigation/DashboardLayout/TopNavigation.tsx +279 -0
- package/src/v2/navigation/DashboardLayout/assets/AdminLogo.png +0 -0
- package/src/v2/navigation/DashboardLayout/assets/BookedLogo_Mark.png +0 -0
- package/src/v2/navigation/DashboardLayout/index.ts +20 -0
- package/src/v2/styles/index.scss +0 -1
- package/src/v2/styles/tokens/_colors.scss +531 -98
- package/dist/v2/components/Colors/Colors.d.ts +0 -21
- package/dist/v2/components/Colors/Colors.d.ts.map +0 -1
- package/dist/v2/components/Colors/index.d.ts +0 -3
- package/dist/v2/components/Colors/index.d.ts.map +0 -1
- package/dist/v2/components/Typography/Typography.d.ts +0 -11
- package/dist/v2/components/Typography/Typography.d.ts.map +0 -1
- package/dist/v2/components/Typography/index.d.ts +0 -3
- package/dist/v2/components/Typography/index.d.ts.map +0 -1
- package/src/v2/components/Colors/Colors.scss +0 -64
- package/src/v2/components/Colors/Colors.stories.tsx +0 -143
- package/src/v2/components/Colors/Colors.tsx +0 -51
- package/src/v2/components/Colors/ColorsAliases.stories.tsx +0 -285
- package/src/v2/components/Colors/Sizes.stories.tsx +0 -141
- package/src/v2/components/Colors/index.ts +0 -2
- package/src/v2/components/Typography/Typography.scss +0 -72
- package/src/v2/components/Typography/Typography.stories.tsx +0 -266
- package/src/v2/components/Typography/Typography.tsx +0 -56
- package/src/v2/components/Typography/index.ts +0 -2
- package/src/v2/styles/tokens/_aliases.scss +0 -199
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip'
|
|
3
|
+
import './Tooltip.scss'
|
|
4
|
+
|
|
5
|
+
const TooltipProvider = TooltipPrimitive.Provider
|
|
6
|
+
|
|
7
|
+
const TooltipRoot = TooltipPrimitive.Root
|
|
8
|
+
|
|
9
|
+
const TooltipTrigger = TooltipPrimitive.Trigger
|
|
10
|
+
|
|
11
|
+
const TooltipContent = React.forwardRef<
|
|
12
|
+
React.ElementRef<typeof TooltipPrimitive.Content>,
|
|
13
|
+
React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>
|
|
14
|
+
>(({ className, sideOffset = 8, ...props }, ref) => (
|
|
15
|
+
<TooltipPrimitive.Content
|
|
16
|
+
ref={ref}
|
|
17
|
+
sideOffset={sideOffset}
|
|
18
|
+
className={`tooltip-content ${className || ''}`.trim()}
|
|
19
|
+
{...props}
|
|
20
|
+
/>
|
|
21
|
+
))
|
|
22
|
+
TooltipContent.displayName = TooltipPrimitive.Content.displayName
|
|
23
|
+
|
|
24
|
+
export interface TooltipProps {
|
|
25
|
+
content: React.ReactNode
|
|
26
|
+
children: React.ReactNode
|
|
27
|
+
side?: 'top' | 'bottom' | 'left' | 'right'
|
|
28
|
+
sideOffset?: number
|
|
29
|
+
delayDuration?: number
|
|
30
|
+
disabled?: boolean
|
|
31
|
+
className?: string
|
|
32
|
+
open?: boolean
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const Tooltip: React.FC<TooltipProps> = ({
|
|
36
|
+
content,
|
|
37
|
+
children,
|
|
38
|
+
side = 'bottom',
|
|
39
|
+
sideOffset = 8,
|
|
40
|
+
delayDuration = 200,
|
|
41
|
+
disabled = false,
|
|
42
|
+
className = '',
|
|
43
|
+
open,
|
|
44
|
+
}) => {
|
|
45
|
+
if (disabled) {
|
|
46
|
+
return <>{children}</>
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<TooltipProvider delayDuration={delayDuration}>
|
|
51
|
+
<TooltipRoot open={open}>
|
|
52
|
+
<TooltipTrigger asChild>
|
|
53
|
+
{children}
|
|
54
|
+
</TooltipTrigger>
|
|
55
|
+
<TooltipContent side={side} sideOffset={sideOffset} className={className}>
|
|
56
|
+
{content}
|
|
57
|
+
</TooltipContent>
|
|
58
|
+
</TooltipRoot>
|
|
59
|
+
</TooltipProvider>
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export { Tooltip, TooltipProvider, TooltipRoot, TooltipTrigger, TooltipContent }
|
|
64
|
+
export type { TooltipProps }
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
.user-avatar {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
border-radius: 50%;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
border: none;
|
|
9
|
+
background: transparent;
|
|
10
|
+
padding: 0;
|
|
11
|
+
cursor: default;
|
|
12
|
+
|
|
13
|
+
&--sm {
|
|
14
|
+
width: 24px;
|
|
15
|
+
height: 24px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&--md {
|
|
19
|
+
width: 32px;
|
|
20
|
+
height: 32px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&--lg {
|
|
24
|
+
width: 47px;
|
|
25
|
+
height: 47px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&--clickable {
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&__image {
|
|
33
|
+
width: 100%;
|
|
34
|
+
height: 100%;
|
|
35
|
+
object-fit: cover;
|
|
36
|
+
border-radius: 50%;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&__bg {
|
|
40
|
+
position: absolute;
|
|
41
|
+
top: 0;
|
|
42
|
+
left: 0;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&__initials {
|
|
46
|
+
font-family: var(--font-family-sans);
|
|
47
|
+
font-weight: 800;
|
|
48
|
+
color: var(--labels-main-label-secondary, #626A90);
|
|
49
|
+
position: absolute;
|
|
50
|
+
top: 50%;
|
|
51
|
+
left: 50%;
|
|
52
|
+
transform: translate(-50%, -50%);
|
|
53
|
+
z-index: 1;
|
|
54
|
+
text-transform: uppercase;
|
|
55
|
+
line-height: 1;
|
|
56
|
+
text-align: center;
|
|
57
|
+
|
|
58
|
+
&--active {
|
|
59
|
+
color: white;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import { UserAvatar } from './UserAvatar'
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'v2/Components/UserAvatar',
|
|
6
|
+
component: UserAvatar,
|
|
7
|
+
argTypes: {
|
|
8
|
+
initials: { control: 'text' },
|
|
9
|
+
avatarUrl: { control: 'text' },
|
|
10
|
+
size: { control: 'select', options: ['sm', 'md', 'lg'] },
|
|
11
|
+
isActive: { control: 'boolean' },
|
|
12
|
+
onClick: { action: 'clicked' },
|
|
13
|
+
},
|
|
14
|
+
parameters: {
|
|
15
|
+
layout: 'centered',
|
|
16
|
+
},
|
|
17
|
+
} as Meta<typeof UserAvatar>
|
|
18
|
+
|
|
19
|
+
type Story = StoryObj<typeof UserAvatar>
|
|
20
|
+
|
|
21
|
+
export const Default: Story = {
|
|
22
|
+
args: {
|
|
23
|
+
initials: 'GA',
|
|
24
|
+
size: 'md',
|
|
25
|
+
isActive: false,
|
|
26
|
+
},
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const Small: Story = {
|
|
30
|
+
args: {
|
|
31
|
+
initials: 'GA',
|
|
32
|
+
size: 'sm',
|
|
33
|
+
isActive: false,
|
|
34
|
+
},
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const Medium: Story = {
|
|
38
|
+
args: {
|
|
39
|
+
initials: 'GA',
|
|
40
|
+
size: 'md',
|
|
41
|
+
isActive: false,
|
|
42
|
+
},
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const Large: Story = {
|
|
46
|
+
args: {
|
|
47
|
+
initials: 'GA',
|
|
48
|
+
size: 'lg',
|
|
49
|
+
isActive: false,
|
|
50
|
+
},
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export const Active: Story = {
|
|
54
|
+
args: {
|
|
55
|
+
initials: 'GA',
|
|
56
|
+
size: 'md',
|
|
57
|
+
isActive: true,
|
|
58
|
+
},
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export const WithImage: Story = {
|
|
62
|
+
args: {
|
|
63
|
+
avatarUrl: 'https://i.pravatar.cc/150?img=68',
|
|
64
|
+
size: 'md',
|
|
65
|
+
},
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export const AllSizes: Story = {
|
|
69
|
+
render: () => (
|
|
70
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '16px' }}>
|
|
71
|
+
<UserAvatar initials="GA" size="sm" />
|
|
72
|
+
<UserAvatar initials="GA" size="md" />
|
|
73
|
+
<UserAvatar initials="GA" size="lg" />
|
|
74
|
+
</div>
|
|
75
|
+
),
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export const AllStates: Story = {
|
|
79
|
+
render: () => (
|
|
80
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '16px' }}>
|
|
81
|
+
<UserAvatar initials="GA" size="md" isActive={false} />
|
|
82
|
+
<UserAvatar initials="GA" size="md" isActive={true} />
|
|
83
|
+
<UserAvatar avatarUrl="https://i.pravatar.cc/150?img=68" size="md" />
|
|
84
|
+
</div>
|
|
85
|
+
),
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export const Clickable: Story = {
|
|
89
|
+
args: {
|
|
90
|
+
initials: 'GA',
|
|
91
|
+
size: 'md',
|
|
92
|
+
onClick: () => alert('Avatar clicked!'),
|
|
93
|
+
},
|
|
94
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import './UserAvatar.scss'
|
|
3
|
+
|
|
4
|
+
export interface UserAvatarProps {
|
|
5
|
+
initials?: string
|
|
6
|
+
avatarUrl?: string
|
|
7
|
+
size?: 'sm' | 'md' | 'lg'
|
|
8
|
+
isActive?: boolean
|
|
9
|
+
onClick?: () => void
|
|
10
|
+
className?: string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const UserAvatar: React.FC<UserAvatarProps> = ({
|
|
14
|
+
initials = 'U',
|
|
15
|
+
avatarUrl,
|
|
16
|
+
size = 'md',
|
|
17
|
+
isActive = false,
|
|
18
|
+
onClick,
|
|
19
|
+
className = '',
|
|
20
|
+
}) => {
|
|
21
|
+
const sizeMap = {
|
|
22
|
+
sm: 24,
|
|
23
|
+
md: 32,
|
|
24
|
+
lg: 47,
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const fontSizeMap = {
|
|
28
|
+
sm: 8,
|
|
29
|
+
md: 10,
|
|
30
|
+
lg: 14,
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const dimension = sizeMap[size]
|
|
34
|
+
const fontSize = fontSizeMap[size]
|
|
35
|
+
const radius = dimension / 2 - 1
|
|
36
|
+
|
|
37
|
+
const fillColor = isActive
|
|
38
|
+
? 'var(--fills-main-fill-primary, #14215A)'
|
|
39
|
+
: 'var(--fills-main-fill-secondary, #626A90)'
|
|
40
|
+
|
|
41
|
+
const handleClick = () => {
|
|
42
|
+
onClick?.()
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const content = avatarUrl ? (
|
|
46
|
+
<img src={avatarUrl} alt="Profile" className="user-avatar__image" />
|
|
47
|
+
) : (
|
|
48
|
+
<>
|
|
49
|
+
<svg
|
|
50
|
+
width={dimension}
|
|
51
|
+
height={dimension}
|
|
52
|
+
viewBox={`0 0 ${dimension} ${dimension}`}
|
|
53
|
+
fill="none"
|
|
54
|
+
className="user-avatar__bg"
|
|
55
|
+
>
|
|
56
|
+
<circle
|
|
57
|
+
cx={dimension / 2}
|
|
58
|
+
cy={dimension / 2}
|
|
59
|
+
r={radius}
|
|
60
|
+
fill={fillColor}
|
|
61
|
+
fillOpacity="0.2"
|
|
62
|
+
stroke={fillColor}
|
|
63
|
+
strokeWidth="2"
|
|
64
|
+
/>
|
|
65
|
+
</svg>
|
|
66
|
+
<span
|
|
67
|
+
className={`user-avatar__initials ${isActive ? 'user-avatar__initials--active' : ''}`}
|
|
68
|
+
style={{ fontSize: `${fontSize}px` }}
|
|
69
|
+
>
|
|
70
|
+
{initials}
|
|
71
|
+
</span>
|
|
72
|
+
</>
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
if (onClick) {
|
|
76
|
+
return (
|
|
77
|
+
<button
|
|
78
|
+
className={`user-avatar user-avatar--${size} user-avatar--clickable ${isActive ? 'user-avatar--active' : ''} ${className}`.trim()}
|
|
79
|
+
onClick={handleClick}
|
|
80
|
+
type="button"
|
|
81
|
+
style={{ width: dimension, height: dimension }}
|
|
82
|
+
>
|
|
83
|
+
{content}
|
|
84
|
+
</button>
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<div
|
|
90
|
+
className={`user-avatar user-avatar--${size} ${isActive ? 'user-avatar--active' : ''} ${className}`.trim()}
|
|
91
|
+
style={{ width: dimension, height: dimension }}
|
|
92
|
+
>
|
|
93
|
+
{content}
|
|
94
|
+
</div>
|
|
95
|
+
)
|
|
96
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { UserAvatar, type UserAvatarProps } from './UserAvatar'
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
.user-panel__overlay {
|
|
2
|
+
position: fixed;
|
|
3
|
+
inset: 0;
|
|
4
|
+
background: rgba(0, 0, 0, 0.2);
|
|
5
|
+
z-index: 40;
|
|
6
|
+
animation: fadeIn 0.2s ease;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.user-panel {
|
|
10
|
+
position: fixed;
|
|
11
|
+
right: 0;
|
|
12
|
+
top: 0;
|
|
13
|
+
height: 100vh;
|
|
14
|
+
width: 100%;
|
|
15
|
+
max-width: 320px;
|
|
16
|
+
background: var(--surfaces-main-surface-primary, #FFFFFF);
|
|
17
|
+
box-shadow: -4px 0 24px rgba(0, 0, 0, 0.1);
|
|
18
|
+
z-index: 50;
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
animation: slideInRight 0.3s ease;
|
|
22
|
+
|
|
23
|
+
@media (max-width: 640px) {
|
|
24
|
+
max-width: 100%;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@keyframes fadeIn {
|
|
29
|
+
from { opacity: 0; }
|
|
30
|
+
to { opacity: 1; }
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@keyframes slideInRight {
|
|
34
|
+
from { transform: translateX(100%); }
|
|
35
|
+
to { transform: translateX(0); }
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.user-panel__header {
|
|
39
|
+
display: flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
justify-content: space-between;
|
|
42
|
+
padding: 16px;
|
|
43
|
+
border-bottom: 1px solid var(--borders-main-border-primary, #E8E9EF);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.user-panel__user-info {
|
|
47
|
+
display: flex;
|
|
48
|
+
align-items: center;
|
|
49
|
+
gap: 8px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.user-panel__avatar {
|
|
53
|
+
width: 32px;
|
|
54
|
+
height: 32px;
|
|
55
|
+
position: relative;
|
|
56
|
+
display: flex;
|
|
57
|
+
align-items: center;
|
|
58
|
+
justify-content: center;
|
|
59
|
+
flex-shrink: 0;
|
|
60
|
+
overflow: hidden;
|
|
61
|
+
border-radius: 50%;
|
|
62
|
+
|
|
63
|
+
img {
|
|
64
|
+
width: 100%;
|
|
65
|
+
height: 100%;
|
|
66
|
+
object-fit: cover;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.user-panel__avatar-bg {
|
|
71
|
+
position: absolute;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.user-panel__avatar-initials {
|
|
75
|
+
font-family: var(--font-family-sans);
|
|
76
|
+
font-size: 10px;
|
|
77
|
+
font-weight: 800;
|
|
78
|
+
line-height: 8px;
|
|
79
|
+
color: var(--labels-main-label-secondary, #626A90);
|
|
80
|
+
position: relative;
|
|
81
|
+
margin-top: 2px;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.user-panel__user-details {
|
|
85
|
+
display: flex;
|
|
86
|
+
flex-direction: column;
|
|
87
|
+
gap: 2px;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.user-panel__greeting {
|
|
91
|
+
font-family: var(--font-family-sans);
|
|
92
|
+
font-size: 14px;
|
|
93
|
+
font-weight: 600;
|
|
94
|
+
line-height: 18px;
|
|
95
|
+
color: var(--labels-main-label-primary, #121E52);
|
|
96
|
+
margin: 0;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.user-panel__email {
|
|
100
|
+
font-family: var(--font-family-sans);
|
|
101
|
+
font-size: 12px;
|
|
102
|
+
line-height: 14px;
|
|
103
|
+
color: var(--labels-main-label-secondary, #626A90);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.user-panel__close-btn {
|
|
107
|
+
padding: 8px;
|
|
108
|
+
border-radius: 8px;
|
|
109
|
+
border: none;
|
|
110
|
+
background: transparent;
|
|
111
|
+
cursor: pointer;
|
|
112
|
+
display: flex;
|
|
113
|
+
align-items: center;
|
|
114
|
+
justify-content: center;
|
|
115
|
+
flex-shrink: 0;
|
|
116
|
+
color: var(--fills-main-fill-primary, #14215A);
|
|
117
|
+
transition: background 0.2s ease;
|
|
118
|
+
|
|
119
|
+
&:hover {
|
|
120
|
+
background: var(--surfaces-main-surface-primary-hover, #F8F8FA);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.user-panel__menu {
|
|
125
|
+
display: flex;
|
|
126
|
+
flex-direction: column;
|
|
127
|
+
flex: 1;
|
|
128
|
+
padding: 8px;
|
|
129
|
+
gap: 4px;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.user-panel__menu-item {
|
|
133
|
+
display: flex;
|
|
134
|
+
align-items: center;
|
|
135
|
+
gap: 8px;
|
|
136
|
+
width: 100%;
|
|
137
|
+
padding: 8px;
|
|
138
|
+
border-radius: 8px;
|
|
139
|
+
border: none;
|
|
140
|
+
background: transparent;
|
|
141
|
+
cursor: pointer;
|
|
142
|
+
text-align: left;
|
|
143
|
+
color: var(--labels-main-label-primary, #121E52);
|
|
144
|
+
transition: background 0.2s ease;
|
|
145
|
+
outline: none;
|
|
146
|
+
|
|
147
|
+
&:hover {
|
|
148
|
+
background: var(--surfaces-main-surface-primary-hover, #F8F8FA);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
&:active {
|
|
152
|
+
background: var(--surfaces-main-surface-primary-pressed, #F0F0F4);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
span {
|
|
156
|
+
font-family: var(--font-family-sans);
|
|
157
|
+
font-size: 13px;
|
|
158
|
+
font-weight: 500;
|
|
159
|
+
line-height: 16px;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
svg {
|
|
163
|
+
flex-shrink: 0;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.user-panel__logout-section {
|
|
168
|
+
padding: 8px;
|
|
169
|
+
padding-top: 4px;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.user-panel__footer {
|
|
173
|
+
padding: 16px;
|
|
174
|
+
border-top: 1px solid var(--borders-main-border-primary, #E8E9EF);
|
|
175
|
+
margin-top: auto;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.user-panel__user-badge {
|
|
179
|
+
display: inline-flex;
|
|
180
|
+
align-items: center;
|
|
181
|
+
justify-content: center;
|
|
182
|
+
padding: 4px 8px;
|
|
183
|
+
background: var(--surfaces-main-surface-tertiary, #E8E9EF);
|
|
184
|
+
border-radius: 8px;
|
|
185
|
+
width: fit-content;
|
|
186
|
+
|
|
187
|
+
span {
|
|
188
|
+
font-family: var(--font-family-mono);
|
|
189
|
+
font-size: 10px;
|
|
190
|
+
font-weight: 600;
|
|
191
|
+
line-height: 12px;
|
|
192
|
+
color: var(--labels-main-label-secondary, #626A90);
|
|
193
|
+
white-space: nowrap;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
3
|
+
import { UserPanel } from './UserPanel'
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof UserPanel> = {
|
|
6
|
+
title: 'v2/Components/UserPanel',
|
|
7
|
+
component: UserPanel,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'fullscreen',
|
|
10
|
+
},
|
|
11
|
+
argTypes: {
|
|
12
|
+
isOpen: { control: 'boolean' },
|
|
13
|
+
userName: { control: 'text' },
|
|
14
|
+
firstName: { control: 'text' },
|
|
15
|
+
email: { control: 'text' },
|
|
16
|
+
initials: { control: 'text' },
|
|
17
|
+
avatarUrl: { control: 'text' },
|
|
18
|
+
userNumber: { control: 'number' },
|
|
19
|
+
userRole: { control: 'text' },
|
|
20
|
+
},
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default meta
|
|
24
|
+
type Story = StoryObj<typeof UserPanel>
|
|
25
|
+
|
|
26
|
+
const Template = (args: any) => {
|
|
27
|
+
const [isOpen, setIsOpen] = useState(args.isOpen)
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<div style={{ minHeight: '100vh', background: 'var(--surfaces-main-background-secondary)', padding: '20px' }}>
|
|
31
|
+
<button
|
|
32
|
+
onClick={() => setIsOpen(true)}
|
|
33
|
+
style={{
|
|
34
|
+
padding: '8px 16px',
|
|
35
|
+
borderRadius: '8px',
|
|
36
|
+
border: '1px solid var(--borders-main-border-primary)',
|
|
37
|
+
background: 'var(--surfaces-main-surface-primary)',
|
|
38
|
+
cursor: 'pointer',
|
|
39
|
+
fontFamily: 'var(--font-family-sans)',
|
|
40
|
+
}}
|
|
41
|
+
>
|
|
42
|
+
Open User Panel
|
|
43
|
+
</button>
|
|
44
|
+
<UserPanel
|
|
45
|
+
{...args}
|
|
46
|
+
isOpen={isOpen}
|
|
47
|
+
onClose={() => setIsOpen(false)}
|
|
48
|
+
/>
|
|
49
|
+
</div>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export const Default: Story = {
|
|
54
|
+
render: Template,
|
|
55
|
+
args: {
|
|
56
|
+
isOpen: true,
|
|
57
|
+
userName: 'Godwin Adebimpe',
|
|
58
|
+
firstName: 'Godwin',
|
|
59
|
+
email: 'godwin.adebimpe@booked.it',
|
|
60
|
+
initials: 'GA',
|
|
61
|
+
userNumber: 15,
|
|
62
|
+
userRole: 'Super Admin',
|
|
63
|
+
onProfileClick: () => console.log('Profile clicked'),
|
|
64
|
+
onLogoutClick: () => console.log('Logout clicked'),
|
|
65
|
+
},
|
|
66
|
+
}
|