@transferwise/components 0.0.0-experimental-f7495f3 → 0.0.0-experimental-37d8e2c
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/build/avatar/Avatar.js +4 -1
- package/build/avatar/Avatar.js.map +1 -1
- package/build/avatar/Avatar.mjs +4 -1
- package/build/avatar/Avatar.mjs.map +1 -1
- package/build/avatar/colors/colors.js +1 -1
- package/build/avatar/colors/colors.js.map +1 -1
- package/build/avatar/colors/colors.mjs +1 -1
- package/build/avatar/colors/colors.mjs.map +1 -1
- package/build/avatarView/AvatarView.js +207 -0
- package/build/avatarView/AvatarView.js.map +1 -0
- package/build/avatarView/AvatarView.mjs +205 -0
- package/build/avatarView/AvatarView.mjs.map +1 -0
- package/build/avatarWrapper/AvatarWrapper.js +6 -9
- package/build/avatarWrapper/AvatarWrapper.js.map +1 -1
- package/build/avatarWrapper/AvatarWrapper.mjs +5 -8
- package/build/avatarWrapper/AvatarWrapper.mjs.map +1 -1
- package/build/badge/Badge.js +6 -1
- package/build/badge/Badge.js.map +1 -1
- package/build/badge/Badge.mjs +6 -1
- package/build/badge/Badge.mjs.map +1 -1
- package/build/circularButton/CircularButton.js +4 -7
- package/build/circularButton/CircularButton.js.map +1 -1
- package/build/circularButton/CircularButton.mjs +4 -7
- package/build/circularButton/CircularButton.mjs.map +1 -1
- package/build/common/circle/Circle.js +24 -1
- package/build/common/circle/Circle.js.map +1 -1
- package/build/common/circle/Circle.mjs +24 -1
- package/build/common/circle/Circle.mjs.map +1 -1
- package/build/common/initials.js +12 -0
- package/build/common/initials.js.map +1 -0
- package/build/common/initials.mjs +10 -0
- package/build/common/initials.mjs.map +1 -0
- package/build/common/notificationDot/NotificationDot.js +16 -0
- package/build/common/notificationDot/NotificationDot.js.map +1 -0
- package/build/common/notificationDot/NotificationDot.mjs +14 -0
- package/build/common/notificationDot/NotificationDot.mjs.map +1 -0
- package/build/display/Display.js +1 -1
- package/build/display/Display.js.map +1 -1
- package/build/display/Display.mjs +1 -1
- package/build/display/Display.mjs.map +1 -1
- package/build/index.js +6 -0
- package/build/index.js.map +1 -1
- package/build/index.mjs +3 -0
- package/build/index.mjs.map +1 -1
- package/build/main.css +82 -41
- package/build/statusIcon/StatusIcon.js +4 -2
- package/build/statusIcon/StatusIcon.js.map +1 -1
- package/build/statusIcon/StatusIcon.mjs +4 -2
- package/build/statusIcon/StatusIcon.mjs.map +1 -1
- package/build/styles/avatarGroup/AvatarGroup.css +28 -0
- package/build/styles/avatarView/AvatarView.css +22 -0
- package/build/styles/badge/Badge.css +5 -5
- package/build/styles/circularButton/CircularButton.css +0 -24
- package/build/styles/common/circle/Circle.css +17 -0
- package/build/styles/common/notificationDot/NotificationDot.css +10 -0
- package/build/styles/main.css +82 -41
- package/build/styles/statusIcon/StatusIcon.css +0 -12
- package/build/types/avatar/Avatar.d.ts +3 -0
- package/build/types/avatar/Avatar.d.ts.map +1 -1
- package/build/types/avatar/colors/colors.d.ts +1 -1
- package/build/types/avatar/colors/colors.d.ts.map +1 -1
- package/build/types/avatarGroup/AvatarGroup.d.ts +19 -0
- package/build/types/avatarGroup/AvatarGroup.d.ts.map +1 -0
- package/build/types/avatarGroup/index.d.ts +3 -0
- package/build/types/avatarGroup/index.d.ts.map +1 -0
- package/build/types/avatarView/AvatarView.d.ts +25 -0
- package/build/types/avatarView/AvatarView.d.ts.map +1 -0
- package/build/types/avatarView/index.d.ts +3 -0
- package/build/types/avatarView/index.d.ts.map +1 -0
- package/build/types/avatarWrapper/AvatarWrapper.d.ts +3 -0
- package/build/types/avatarWrapper/AvatarWrapper.d.ts.map +1 -1
- package/build/types/badge/Badge.d.ts +2 -1
- package/build/types/badge/Badge.d.ts.map +1 -1
- package/build/types/circularButton/CircularButton.d.ts.map +1 -1
- package/build/types/common/circle/Circle.d.ts +1 -1
- package/build/types/common/circle/Circle.d.ts.map +1 -1
- package/build/types/common/index.d.ts +1 -0
- package/build/types/common/initials.d.ts +2 -0
- package/build/types/common/initials.d.ts.map +1 -0
- package/build/types/common/notificationDot/NotificationDot.d.ts +8 -0
- package/build/types/common/notificationDot/NotificationDot.d.ts.map +1 -0
- package/build/types/index.d.ts +4 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/statusIcon/StatusIcon.d.ts +6 -2
- package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/avatar/Avatar.tsx +4 -1
- package/src/avatar/colors/colors.ts +4 -4
- package/src/avatarGroup/AvatarGroup.css +28 -0
- package/src/avatarGroup/AvatarGroup.less +32 -0
- package/src/avatarGroup/AvatarGroup.story.tsx +249 -0
- package/src/avatarGroup/AvatarGroup.tsx +78 -0
- package/src/avatarGroup/index.ts +2 -0
- package/src/avatarView/AvatarView.css +22 -0
- package/src/avatarView/AvatarView.less +24 -0
- package/src/avatarView/AvatarView.story.tsx +425 -0
- package/src/avatarView/AvatarView.tsx +217 -0
- package/src/avatarView/index.ts +2 -0
- package/src/avatarWrapper/AvatarWrapper.tsx +12 -16
- package/src/badge/Badge.css +5 -5
- package/src/badge/Badge.less +3 -3
- package/src/badge/Badge.tsx +10 -1
- package/src/circularButton/CircularButton.css +0 -24
- package/src/circularButton/CircularButton.less +15 -15
- package/src/circularButton/CircularButton.tsx +4 -5
- package/src/common/circle/Circle.css +17 -0
- package/src/common/circle/Circle.less +22 -0
- package/src/common/circle/Circle.tsx +33 -2
- package/src/common/index.js +1 -0
- package/src/common/initials.ts +13 -0
- package/src/common/notificationDot/NotificationDot.css +10 -0
- package/src/common/notificationDot/NotificationDot.less +7 -0
- package/src/common/notificationDot/NotificationDot.tsx +10 -0
- package/src/display/Display.tsx +1 -1
- package/src/index.ts +4 -0
- package/src/main.css +82 -41
- package/src/main.less +3 -0
- package/src/statusIcon/StatusIcon.css +0 -12
- package/src/statusIcon/StatusIcon.less +6 -6
- package/src/statusIcon/StatusIcon.story.tsx +32 -28
- package/src/statusIcon/StatusIcon.tsx +18 -4
- package/src/test-utils/avatar-img.webp +0 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
2
|
+
/* eslint-disable react/jsx-key */
|
|
3
|
+
import { clsx } from 'clsx';
|
|
4
|
+
import { CommonProps } from '../common';
|
|
5
|
+
import { ReactNode } from 'react';
|
|
6
|
+
import AvatarView, { AvatarViewProps } from '../avatarView';
|
|
7
|
+
|
|
8
|
+
type AvatarType = { asset: ReactNode } & Pick<
|
|
9
|
+
AvatarViewProps,
|
|
10
|
+
'type' | 'backgroundColor' | 'borderColor' | 'className'
|
|
11
|
+
>;
|
|
12
|
+
type AvatarGroupOrientation = 'horizontal' | 'diagonal';
|
|
13
|
+
type AvatarGroupDiagonalSize = 24 | 32 | 40 | 48 | 56 | 72;
|
|
14
|
+
type AvatarGroupSize = 16 | AvatarGroupDiagonalSize;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Diagonal orientation uses custom sizes for avatars
|
|
18
|
+
*/
|
|
19
|
+
const avatarGroupDiagonalSizeMap: Record<AvatarGroupDiagonalSize, number> = {
|
|
20
|
+
24: 15,
|
|
21
|
+
32: 20,
|
|
22
|
+
40: 24,
|
|
23
|
+
48: 30,
|
|
24
|
+
56: 34,
|
|
25
|
+
72: 44,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type Props = {
|
|
29
|
+
'aria-label'?: string;
|
|
30
|
+
avatars: AvatarType[];
|
|
31
|
+
orientation?: AvatarGroupOrientation;
|
|
32
|
+
size?: AvatarGroupSize;
|
|
33
|
+
interactive?: boolean;
|
|
34
|
+
} & CommonProps;
|
|
35
|
+
|
|
36
|
+
export default function AvatarGroup({
|
|
37
|
+
avatars,
|
|
38
|
+
orientation: orientationProp = 'horizontal',
|
|
39
|
+
size = 48,
|
|
40
|
+
'aria-label': ariaLabel,
|
|
41
|
+
className,
|
|
42
|
+
interactive,
|
|
43
|
+
}: Props) {
|
|
44
|
+
const orientation =
|
|
45
|
+
orientationProp === 'diagonal' && size === 16 ? 'horizontal' : orientationProp;
|
|
46
|
+
const avatarSize = orientation === 'diagonal' ? avatarGroupDiagonalSizeMap[size] : size;
|
|
47
|
+
return (
|
|
48
|
+
<div
|
|
49
|
+
className={clsx('np-avatar-group', `np-avatar-group-${orientation}`, className)}
|
|
50
|
+
// @ts-expect-error `--np-avatar-group-size` exsits in styles of AvatarGroup
|
|
51
|
+
style={{ '--np-avatar-group-size': `${size}px`, '--np-avatar-size': `${avatarSize}px` }}
|
|
52
|
+
aria-label={ariaLabel}
|
|
53
|
+
>
|
|
54
|
+
{avatars.length > 1
|
|
55
|
+
? avatars.map((avatar, index) => (
|
|
56
|
+
<AvatarView
|
|
57
|
+
key={index}
|
|
58
|
+
{...avatar}
|
|
59
|
+
className={clsx(
|
|
60
|
+
{ [`np-avatar-group-${orientation}-child`]: index !== 0 },
|
|
61
|
+
{ [`np-avatar-group-${orientation}-mask`]: index !== avatars.length - 1 },
|
|
62
|
+
avatar.className,
|
|
63
|
+
)}
|
|
64
|
+
style={{
|
|
65
|
+
// @ts-expect-error CSS custom props allowed
|
|
66
|
+
'--np-avatar-group-index': index,
|
|
67
|
+
'--circle-size': `${avatarSize}px`,
|
|
68
|
+
}}
|
|
69
|
+
size={avatarSize}
|
|
70
|
+
interactive={interactive}
|
|
71
|
+
>
|
|
72
|
+
{avatar.asset}
|
|
73
|
+
</AvatarView>
|
|
74
|
+
))
|
|
75
|
+
: null}
|
|
76
|
+
</div>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
.np-avatar-view {
|
|
2
|
+
border-radius: 9999px;
|
|
3
|
+
border-radius: var(--radius-full);
|
|
4
|
+
color: var(--color-interactive-primary);
|
|
5
|
+
height: -moz-fit-content;
|
|
6
|
+
height: fit-content;
|
|
7
|
+
width: -moz-fit-content;
|
|
8
|
+
width: fit-content;
|
|
9
|
+
}
|
|
10
|
+
.np-avatar-view .np-circle {
|
|
11
|
+
background-color: transparent;
|
|
12
|
+
border: var(--avatar-view-non-interactive-border-width) solid rgba(0,0,0,0.10196);
|
|
13
|
+
border: var(--avatar-view-non-interactive-border-width) solid var(--color-border-neutral);
|
|
14
|
+
}
|
|
15
|
+
.np-avatar-view-selected .np-circle {
|
|
16
|
+
border: var(--avatar-view-selected-border-width) solid var(--color-interactive-primary) !important;
|
|
17
|
+
}
|
|
18
|
+
.np-avatar-view-interactive .np-circle {
|
|
19
|
+
background-color: rgba(134,167,189,0.10196);
|
|
20
|
+
background-color: var(--color-background-neutral);
|
|
21
|
+
border: none;
|
|
22
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
.np-avatar-view {
|
|
2
|
+
border-radius: var(--radius-full);
|
|
3
|
+
color: var(--color-interactive-primary);
|
|
4
|
+
height: fit-content;
|
|
5
|
+
width: fit-content;
|
|
6
|
+
|
|
7
|
+
.np-circle {
|
|
8
|
+
background-color: transparent;
|
|
9
|
+
border: var(--avatar-view-non-interactive-border-width) solid var(--color-border-neutral);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
&-selected {
|
|
13
|
+
.np-circle {
|
|
14
|
+
border: var(--avatar-view-selected-border-width) solid var(--color-interactive-primary) !important;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&-interactive {
|
|
19
|
+
.np-circle {
|
|
20
|
+
background-color: var(--color-background-neutral);
|
|
21
|
+
border: none;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
/* eslint-disable react/jsx-key */
|
|
2
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import { storyConfig } from '../test-utils';
|
|
4
|
+
import {
|
|
5
|
+
Freeze,
|
|
6
|
+
Graph,
|
|
7
|
+
Leaf,
|
|
8
|
+
MassPayout,
|
|
9
|
+
Money,
|
|
10
|
+
Plane,
|
|
11
|
+
PlusCircle,
|
|
12
|
+
QrCode,
|
|
13
|
+
Rewards,
|
|
14
|
+
Target,
|
|
15
|
+
Team,
|
|
16
|
+
Transport,
|
|
17
|
+
Wallet,
|
|
18
|
+
Water,
|
|
19
|
+
} from '@transferwise/icons';
|
|
20
|
+
import { action } from '@storybook/addon-actions';
|
|
21
|
+
import { useState } from 'react';
|
|
22
|
+
import AvatarView, { AvatarViewProps } from '.';
|
|
23
|
+
import { Flag } from '@wise/art';
|
|
24
|
+
import Body from '../body';
|
|
25
|
+
import AvatarWrapper from '../avatarWrapper';
|
|
26
|
+
import { getInitials, Sentiment } from '../common';
|
|
27
|
+
import Display from '../display';
|
|
28
|
+
import { get } from 'lodash';
|
|
29
|
+
import { getAvatarColorFromSeed } from '../avatar/colors';
|
|
30
|
+
|
|
31
|
+
export default {
|
|
32
|
+
title: 'Content/AvatarView',
|
|
33
|
+
} satisfies Meta<typeof AvatarView>;
|
|
34
|
+
|
|
35
|
+
type Story = StoryObj<typeof AvatarView>;
|
|
36
|
+
|
|
37
|
+
const profileName1 = 'Wolter White';
|
|
38
|
+
const profileName2 = 'Tyler Durden';
|
|
39
|
+
const sizes: AvatarViewProps['size'][] = [16, 24, 32, 40, 48, 56, 72];
|
|
40
|
+
|
|
41
|
+
export const Selected: Story = storyConfig(
|
|
42
|
+
{
|
|
43
|
+
render: () => {
|
|
44
|
+
const [selected, setSelected] = useState(true);
|
|
45
|
+
return (
|
|
46
|
+
<div
|
|
47
|
+
style={{
|
|
48
|
+
gap: '1em',
|
|
49
|
+
display: 'grid',
|
|
50
|
+
justifyContent: 'space-between',
|
|
51
|
+
gridTemplate: `auto auto / repeat(${sizes.length}, min-content)`,
|
|
52
|
+
}}
|
|
53
|
+
>
|
|
54
|
+
{sizes.map((size) => (
|
|
55
|
+
<AvatarView key={size} size={size} selected={selected}>
|
|
56
|
+
<Freeze />
|
|
57
|
+
</AvatarView>
|
|
58
|
+
))}
|
|
59
|
+
{sizes.map((size) => (
|
|
60
|
+
<AvatarView
|
|
61
|
+
key={size}
|
|
62
|
+
size={size}
|
|
63
|
+
selected={selected}
|
|
64
|
+
action={{
|
|
65
|
+
onClick: () => {
|
|
66
|
+
action('interactive avatar');
|
|
67
|
+
setSelected(!selected);
|
|
68
|
+
},
|
|
69
|
+
}}
|
|
70
|
+
>
|
|
71
|
+
<Freeze />
|
|
72
|
+
</AvatarView>
|
|
73
|
+
))}
|
|
74
|
+
</div>
|
|
75
|
+
);
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
{ variants: ['light', 'dark'] },
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
export const Notification: Story = storyConfig(
|
|
82
|
+
{
|
|
83
|
+
render: () => (
|
|
84
|
+
<div
|
|
85
|
+
style={{
|
|
86
|
+
gap: '1em',
|
|
87
|
+
display: 'grid',
|
|
88
|
+
justifyContent: 'space-between',
|
|
89
|
+
gridTemplate: `auto auto / repeat(${sizes.length}, min-content)`,
|
|
90
|
+
}}
|
|
91
|
+
>
|
|
92
|
+
{sizes.map((size) => (
|
|
93
|
+
<AvatarView key={size} size={size} notification>
|
|
94
|
+
<MassPayout />
|
|
95
|
+
</AvatarView>
|
|
96
|
+
))}
|
|
97
|
+
{sizes.map((size) => (
|
|
98
|
+
<AvatarView
|
|
99
|
+
key={size}
|
|
100
|
+
size={size}
|
|
101
|
+
notification
|
|
102
|
+
action={{
|
|
103
|
+
onClick: () => action('interactive avatar'),
|
|
104
|
+
}}
|
|
105
|
+
>
|
|
106
|
+
<MassPayout />
|
|
107
|
+
</AvatarView>
|
|
108
|
+
))}
|
|
109
|
+
|
|
110
|
+
{sizes.map((size) => (
|
|
111
|
+
<AvatarView key={size} size={size} notification action={{ href: '#' }}>
|
|
112
|
+
<MassPayout />
|
|
113
|
+
</AvatarView>
|
|
114
|
+
))}
|
|
115
|
+
</div>
|
|
116
|
+
),
|
|
117
|
+
},
|
|
118
|
+
{ variants: ['light', 'dark'] },
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
export const Badge: Story = storyConfig(
|
|
122
|
+
{
|
|
123
|
+
render: () => {
|
|
124
|
+
const currencies = ['USD', 'EUR', 'GBP', 'AUD', 'CAD', 'JPY', 'CNY'];
|
|
125
|
+
const icons = [
|
|
126
|
+
<Plane />,
|
|
127
|
+
<QrCode />,
|
|
128
|
+
<Target />,
|
|
129
|
+
<Transport />,
|
|
130
|
+
<Wallet />,
|
|
131
|
+
<Water />,
|
|
132
|
+
<Team />,
|
|
133
|
+
];
|
|
134
|
+
return (
|
|
135
|
+
<div
|
|
136
|
+
style={{
|
|
137
|
+
gap: '1em',
|
|
138
|
+
display: 'grid',
|
|
139
|
+
justifyContent: 'space-between',
|
|
140
|
+
gridTemplate: 'auto auto / repeat(7, min-content)',
|
|
141
|
+
}}
|
|
142
|
+
>
|
|
143
|
+
{sizes.map((size, index) => (
|
|
144
|
+
<AvatarView key={size} size={size} badge={<Flag code={currencies[index]} />}>
|
|
145
|
+
{icons[index]}
|
|
146
|
+
</AvatarView>
|
|
147
|
+
))}
|
|
148
|
+
|
|
149
|
+
{sizes.map((size, index) => (
|
|
150
|
+
<AvatarView
|
|
151
|
+
key={size}
|
|
152
|
+
size={size}
|
|
153
|
+
badge={<Flag code={currencies[index]} />}
|
|
154
|
+
action={{ onClick: action('onClick') }}
|
|
155
|
+
entity={{ name: 'Test Name' }}
|
|
156
|
+
>
|
|
157
|
+
{icons[index]}
|
|
158
|
+
</AvatarView>
|
|
159
|
+
))}
|
|
160
|
+
</div>
|
|
161
|
+
);
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
{ variants: ['light', 'dark'] },
|
|
165
|
+
);
|
|
166
|
+
|
|
167
|
+
export const Interactive: Story = storyConfig(
|
|
168
|
+
{
|
|
169
|
+
render: () => {
|
|
170
|
+
return (
|
|
171
|
+
<div
|
|
172
|
+
style={{
|
|
173
|
+
gap: '1em',
|
|
174
|
+
display: 'grid',
|
|
175
|
+
justifyContent: 'space-between',
|
|
176
|
+
gridTemplate: 'auto auto / repeat(2, min-content)',
|
|
177
|
+
}}
|
|
178
|
+
>
|
|
179
|
+
<Body type="body-large-bold">Button</Body>
|
|
180
|
+
<Body type="body-large-bold">Link</Body>
|
|
181
|
+
|
|
182
|
+
<AvatarView
|
|
183
|
+
action={{ onClick: action('onClick') }}
|
|
184
|
+
entity={{
|
|
185
|
+
imageSrc: '../avatar-img.webp',
|
|
186
|
+
}}
|
|
187
|
+
/>
|
|
188
|
+
|
|
189
|
+
<AvatarView
|
|
190
|
+
action={{ href: '#' }}
|
|
191
|
+
entity={{
|
|
192
|
+
imageSrc: '../avatar-img.webp',
|
|
193
|
+
}}
|
|
194
|
+
/>
|
|
195
|
+
|
|
196
|
+
<AvatarView
|
|
197
|
+
action={{ onClick: action('onClick') }}
|
|
198
|
+
badge={<Flag code="EU" />}
|
|
199
|
+
entity={{
|
|
200
|
+
imageSrc: '../avatar-img.webp',
|
|
201
|
+
name: 'Test Name',
|
|
202
|
+
}}
|
|
203
|
+
/>
|
|
204
|
+
|
|
205
|
+
<AvatarView
|
|
206
|
+
action={{ href: '#' }}
|
|
207
|
+
badge={<Flag code="EU" />}
|
|
208
|
+
entity={{
|
|
209
|
+
imageSrc: '../avatar-img.webp',
|
|
210
|
+
name: 'Test Name',
|
|
211
|
+
}}
|
|
212
|
+
/>
|
|
213
|
+
|
|
214
|
+
<AvatarView action={{ onClick: action('onClick') }} entity={{ name: 'Test Name' }} />
|
|
215
|
+
|
|
216
|
+
<AvatarView action={{ href: '#' }} entity={{ name: 'Test Name' }} />
|
|
217
|
+
|
|
218
|
+
<AvatarView
|
|
219
|
+
action={{ onClick: action('onClick') }}
|
|
220
|
+
badge={<Flag code="EU" />}
|
|
221
|
+
entity={{ name: 'Test Name' }}
|
|
222
|
+
/>
|
|
223
|
+
|
|
224
|
+
<AvatarView
|
|
225
|
+
action={{ href: '#' }}
|
|
226
|
+
badge={<Flag code="EU" />}
|
|
227
|
+
entity={{ name: 'Test Name' }}
|
|
228
|
+
/>
|
|
229
|
+
|
|
230
|
+
<AvatarView action={{ onClick: action('onClick') }}>
|
|
231
|
+
<Leaf />
|
|
232
|
+
</AvatarView>
|
|
233
|
+
|
|
234
|
+
<AvatarView action={{ href: '#' }}>
|
|
235
|
+
<Leaf />
|
|
236
|
+
</AvatarView>
|
|
237
|
+
|
|
238
|
+
<AvatarView action={{ onClick: action('onClick') }} badge={<Flag code="EU" />}>
|
|
239
|
+
<Leaf />
|
|
240
|
+
</AvatarView>
|
|
241
|
+
|
|
242
|
+
<AvatarView action={{ href: '#' }} badge={<Flag code="EU" />}>
|
|
243
|
+
<Leaf />
|
|
244
|
+
</AvatarView>
|
|
245
|
+
</div>
|
|
246
|
+
);
|
|
247
|
+
},
|
|
248
|
+
},
|
|
249
|
+
{ variants: ['light', 'dark'] },
|
|
250
|
+
);
|
|
251
|
+
|
|
252
|
+
export const Entity: Story = storyConfig(
|
|
253
|
+
{
|
|
254
|
+
render: () => {
|
|
255
|
+
return (
|
|
256
|
+
<div
|
|
257
|
+
style={{
|
|
258
|
+
gap: '1em',
|
|
259
|
+
display: 'grid',
|
|
260
|
+
justifyContent: 'space-between',
|
|
261
|
+
gridTemplate: 'auto auto / repeat(7, min-content)',
|
|
262
|
+
}}
|
|
263
|
+
>
|
|
264
|
+
{sizes.map((size) => (
|
|
265
|
+
<AvatarView
|
|
266
|
+
key={size}
|
|
267
|
+
size={size}
|
|
268
|
+
entity={{
|
|
269
|
+
imageSrc: '../avatar-img.webp',
|
|
270
|
+
name: 'Test Name',
|
|
271
|
+
profileType: 'business',
|
|
272
|
+
}}
|
|
273
|
+
/>
|
|
274
|
+
))}
|
|
275
|
+
|
|
276
|
+
{sizes.map((size) => (
|
|
277
|
+
<AvatarView
|
|
278
|
+
key={size}
|
|
279
|
+
size={size}
|
|
280
|
+
action={{ onClick: action('onClick') }}
|
|
281
|
+
entity={{
|
|
282
|
+
imageSrc: '../avatar-img.webp',
|
|
283
|
+
name: 'Test Name',
|
|
284
|
+
profileType: 'business',
|
|
285
|
+
}}
|
|
286
|
+
/>
|
|
287
|
+
))}
|
|
288
|
+
|
|
289
|
+
{sizes.map((size) => (
|
|
290
|
+
<AvatarView key={size} size={size} entity={{ name: 'Test Name' }} />
|
|
291
|
+
))}
|
|
292
|
+
|
|
293
|
+
{sizes.map((size) => (
|
|
294
|
+
<AvatarView
|
|
295
|
+
key={size}
|
|
296
|
+
size={size}
|
|
297
|
+
action={{ onClick: action('onClick') }}
|
|
298
|
+
entity={{ name: 'Test Name' }}
|
|
299
|
+
/>
|
|
300
|
+
))}
|
|
301
|
+
|
|
302
|
+
{sizes.map((size) => (
|
|
303
|
+
<AvatarView key={size} size={size} entity={{ profileType: 'business' }} />
|
|
304
|
+
))}
|
|
305
|
+
|
|
306
|
+
{sizes.map((size) => (
|
|
307
|
+
<AvatarView
|
|
308
|
+
key={size}
|
|
309
|
+
size={size}
|
|
310
|
+
action={{ onClick: action('onClick') }}
|
|
311
|
+
entity={{ profileType: 'business' }}
|
|
312
|
+
/>
|
|
313
|
+
))}
|
|
314
|
+
|
|
315
|
+
{sizes.map((size) => (
|
|
316
|
+
<AvatarView key={size} size={size} />
|
|
317
|
+
))}
|
|
318
|
+
|
|
319
|
+
{sizes.map((size) => (
|
|
320
|
+
<AvatarView key={size} size={size} action={{ onClick: action('onClick') }} />
|
|
321
|
+
))}
|
|
322
|
+
</div>
|
|
323
|
+
);
|
|
324
|
+
},
|
|
325
|
+
},
|
|
326
|
+
{ variants: ['light', 'dark'] },
|
|
327
|
+
);
|
|
328
|
+
|
|
329
|
+
export const BrokenImageFallback: Story = {
|
|
330
|
+
render: () => <AvatarView entity={{ imageSrc: '../img-wrong-url.lol' }} />,
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
export const EdgeInstaces: Story = {
|
|
334
|
+
render: () => {
|
|
335
|
+
const css = `.custom-variant {
|
|
336
|
+
border: 1px dotted black;
|
|
337
|
+
}`;
|
|
338
|
+
return (
|
|
339
|
+
<div
|
|
340
|
+
style={{
|
|
341
|
+
gap: '1em',
|
|
342
|
+
display: 'grid',
|
|
343
|
+
justifyContent: 'space-between',
|
|
344
|
+
gridTemplate: 'auto auto / repeat(2, min-content)',
|
|
345
|
+
}}
|
|
346
|
+
>
|
|
347
|
+
<style>{css}</style>
|
|
348
|
+
{/* <Body>- Custom colors</Body> */}
|
|
349
|
+
<AvatarView
|
|
350
|
+
action={{ onClick: action('onClick') }}
|
|
351
|
+
badge={<Flag code="eu" />}
|
|
352
|
+
style={{ backgroundColor: 'var(--color-bright-orange)' }}
|
|
353
|
+
>
|
|
354
|
+
<Money />
|
|
355
|
+
</AvatarView>
|
|
356
|
+
<AvatarView
|
|
357
|
+
badge={<Flag code="eu" />}
|
|
358
|
+
style={{ backgroundColor: 'var(--color-bright-orange)' }}
|
|
359
|
+
>
|
|
360
|
+
<Money />
|
|
361
|
+
</AvatarView>
|
|
362
|
+
{/* <Body>- Add example with dashed avatar as in shared balances</Body> */}
|
|
363
|
+
<AvatarView action={{ onClick: action('onClick') }} className="custom-variant">
|
|
364
|
+
<PlusCircle />
|
|
365
|
+
</AvatarView>
|
|
366
|
+
<AvatarView action={{ href: '#' }} className="custom-variant">
|
|
367
|
+
<PlusCircle />
|
|
368
|
+
</AvatarView>
|
|
369
|
+
<AvatarView action={{ href: '#' }} className="custom-variant">
|
|
370
|
+
{null}
|
|
371
|
+
</AvatarView>
|
|
372
|
+
{/* <Body> - Add example custom backgrounds as in account summary (https://wise.com/account-summary)</Body> */}
|
|
373
|
+
<AvatarView style={{ backgroundColor: 'rgb(203, 217, 195)' }}>
|
|
374
|
+
<span style={{ color: 'rgb(22, 51, 0)' }}>
|
|
375
|
+
<Graph />
|
|
376
|
+
</span>
|
|
377
|
+
</AvatarView>
|
|
378
|
+
<AvatarView
|
|
379
|
+
action={{ onClick: action('onClikc') }}
|
|
380
|
+
style={{ backgroundColor: 'rgb(203, 217, 195)' }}
|
|
381
|
+
>
|
|
382
|
+
<span style={{ color: 'rgb(22, 51, 0)' }}>
|
|
383
|
+
<Graph />
|
|
384
|
+
</span>
|
|
385
|
+
</AvatarView>
|
|
386
|
+
<AvatarView style={{ backgroundColor: 'rgb(22, 51, 0)' }}>
|
|
387
|
+
<span style={{ color: 'rgb(203, 217, 195)' }}>
|
|
388
|
+
<Rewards />
|
|
389
|
+
</span>
|
|
390
|
+
</AvatarView>
|
|
391
|
+
<AvatarView
|
|
392
|
+
action={{ onClick: action('onClikc') }}
|
|
393
|
+
style={{ backgroundColor: 'rgb(22, 51, 0)' }}
|
|
394
|
+
>
|
|
395
|
+
<span style={{ color: 'rgb(203, 217, 195)' }}>
|
|
396
|
+
<Rewards />
|
|
397
|
+
</span>
|
|
398
|
+
</AvatarView>
|
|
399
|
+
{/* <Body>- Add example Wise Sand + custom background from hash</Body> */}
|
|
400
|
+
<AvatarView
|
|
401
|
+
badge={<Flag code="eu" />}
|
|
402
|
+
style={{ backgroundColor: getAvatarColorFromSeed(profileName1) }}
|
|
403
|
+
>
|
|
404
|
+
<Display>{getInitials(profileName1)}</Display>
|
|
405
|
+
</AvatarView>
|
|
406
|
+
<AvatarView style={{ backgroundColor: getAvatarColorFromSeed(profileName1) }}>
|
|
407
|
+
<Display>{getInitials(profileName1)}</Display>
|
|
408
|
+
</AvatarView>
|
|
409
|
+
<AvatarView
|
|
410
|
+
action={{ onClick: action('onClick') }}
|
|
411
|
+
style={{ backgroundColor: getAvatarColorFromSeed(profileName2) }}
|
|
412
|
+
>
|
|
413
|
+
<Display>{getInitials(profileName1)}</Display>
|
|
414
|
+
</AvatarView>
|
|
415
|
+
<AvatarView
|
|
416
|
+
action={{ href: '#' }}
|
|
417
|
+
badge={<Flag code="eu" />}
|
|
418
|
+
style={{ backgroundColor: getAvatarColorFromSeed(profileName2) }}
|
|
419
|
+
>
|
|
420
|
+
<Display>{getInitials(profileName1)}</Display>
|
|
421
|
+
</AvatarView>
|
|
422
|
+
</div>
|
|
423
|
+
);
|
|
424
|
+
},
|
|
425
|
+
};
|