@workday/canvas-kit-docs 15.0.0-alpha.0076-next.0 → 15.0.0-alpha.0077-next.0
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/es6/lib/StorybookStatusIndicator.d.ts +2 -2
- package/dist/es6/lib/StorybookStatusIndicator.d.ts.map +1 -1
- package/dist/es6/lib/StorybookStatusIndicator.js +6 -1
- package/dist/es6/lib/docs.js +7730 -8790
- package/dist/es6/mdx/accessibility/examples/GlobalHeader.js +1 -1
- package/dist/mdx/15.0-UPGRADE-GUIDE.mdx +127 -0
- package/dist/mdx/preview-react/divider/examples/Basic.tsx +1 -1
- package/dist/mdx/{preview-react → react}/avatar/Avatar.mdx +5 -7
- package/dist/mdx/react/avatar/examples/Basic.tsx +5 -0
- package/dist/mdx/{preview-react → react}/avatar/examples/Custom.tsx +1 -1
- package/dist/mdx/{preview-react → react}/avatar/examples/Decorative.tsx +1 -1
- package/dist/mdx/{preview-react → react}/avatar/examples/Image.tsx +1 -1
- package/dist/mdx/{preview-react → react}/avatar/examples/Size.tsx +1 -1
- package/dist/mdx/{preview-react → react}/avatar/examples/Variant.tsx +1 -1
- package/lib/StorybookStatusIndicator.tsx +10 -1
- package/package.json +6 -6
- package/dist/mdx/preview-react/avatar/examples/Basic.tsx +0 -5
- package/dist/mdx/react/avatar/avatar/Avatar.mdx +0 -109
- package/dist/mdx/react/avatar/avatar/examples/Basic.tsx +0 -17
- package/dist/mdx/react/avatar/avatar/examples/Button.tsx +0 -20
- package/dist/mdx/react/avatar/avatar/examples/CustomStyles.tsx +0 -34
- package/dist/mdx/react/avatar/avatar/examples/Image.tsx +0 -25
- package/dist/mdx/react/avatar/avatar/examples/LazyLoad.tsx +0 -20
- package/dist/mdx/react/avatar/avatar/examples/ObjectFit.tsx +0 -30
- package/dist/mdx/react/avatar/avatar/examples/Size.tsx +0 -27
- package/dist/mdx/react/avatar/avatar/examples/Variant.tsx +0 -10
- package/dist/mdx/react/avatar/avatar/examples/test-avatar.png +0 -0
- /package/dist/mdx/{preview-react → react}/avatar/examples/nicholas-avatar.jpg +0 -0
|
@@ -5,7 +5,7 @@ import { system } from '@workday/canvas-tokens-web';
|
|
|
5
5
|
import { calc, createStyles, px2rem } from '@workday/canvas-kit-styling';
|
|
6
6
|
import { notificationsIcon, inboxIcon, justifyIcon, assistantIcon, searchIcon, } from '@workday/canvas-system-icons-web';
|
|
7
7
|
import { SecondaryButton, TertiaryButton } from '@workday/canvas-kit-react/button';
|
|
8
|
-
import { Avatar } from '@workday/canvas-kit-
|
|
8
|
+
import { Avatar } from '@workday/canvas-kit-react/avatar';
|
|
9
9
|
import { Flex } from '@workday/canvas-kit-react/layout';
|
|
10
10
|
import { Tooltip } from '@workday/canvas-kit-react/tooltip';
|
|
11
11
|
import { Combobox, useComboboxModel, useComboboxInput, useComboboxLoader, } from '@workday/canvas-kit-react/combobox';
|
|
@@ -18,6 +18,7 @@ space tokens, the new tokens aim to add more semantic meaning to allow for bette
|
|
|
18
18
|
- [Codemod](#codemod)
|
|
19
19
|
- [Instructions](#instructions)
|
|
20
20
|
- [Component Promotions](#component-promotions)
|
|
21
|
+
- [Avatar](#avatar-)
|
|
21
22
|
- [Pill](#pill-)
|
|
22
23
|
- [Segmented Control](#segmented-control-)
|
|
23
24
|
- [Information Highlight](#information-highlight-)
|
|
@@ -31,6 +32,7 @@ space tokens, the new tokens aim to add more semantic meaning to allow for bette
|
|
|
31
32
|
- [Component Updates](#component-updates)
|
|
32
33
|
- [Buttons](#buttons)
|
|
33
34
|
- [Removals](#removals)
|
|
35
|
+
- [Avatar (Deprecated)](#avatar-deprecated)
|
|
34
36
|
- [Segmented Control (Deprecated)](#segmented-control-deprecated)
|
|
35
37
|
- [Select (Deprecated)](#select-deprecated)
|
|
36
38
|
- [Search Form (Labs)](#search-form-labs)
|
|
@@ -106,6 +108,121 @@ yarn remove @workday/canvas-kit-codemod
|
|
|
106
108
|
|
|
107
109
|
## Component Promotions
|
|
108
110
|
|
|
111
|
+
### Avatar ⚡️
|
|
112
|
+
|
|
113
|
+
**PR:** [](https://github.com/Workday/canvas-kit/issues/3659)
|
|
114
|
+
|
|
115
|
+
We've promoted `Avatar` from [Preview](#preview) to [Main](#main). This replaces the deprecated `Avatar` that was previously in Main.
|
|
116
|
+
|
|
117
|
+
**Before in v14**
|
|
118
|
+
|
|
119
|
+
```tsx
|
|
120
|
+
import {Avatar} from '@workday/canvas-kit-preview-react/avatar';
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**After in v15**
|
|
124
|
+
|
|
125
|
+
```tsx
|
|
126
|
+
import {Avatar} from '@workday/canvas-kit-react/avatar';
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
> 🤖 The codemod will handle the change of imports as shown above.
|
|
130
|
+
|
|
131
|
+
#### API Differences
|
|
132
|
+
|
|
133
|
+
The new `Avatar` is a [compound component](/getting-started/for-developers/resources/compound-components/)
|
|
134
|
+
with a different API than the deprecated version.
|
|
135
|
+
|
|
136
|
+
##### Structure Changes
|
|
137
|
+
|
|
138
|
+
| Deprecated (Old Main) | New (Promoted from Preview) |
|
|
139
|
+
| --------------------- | ----------------------------------- |
|
|
140
|
+
| `Avatar` | `Avatar` |
|
|
141
|
+
| - | `BaseAvatar` |
|
|
142
|
+
| - | `BaseAvatar.Image` / `AvatarImage` |
|
|
143
|
+
| - | `BaseAvatar.Name` / `AvatarName` |
|
|
144
|
+
|
|
145
|
+
##### Prop Changes
|
|
146
|
+
|
|
147
|
+
| Feature | Deprecated (Old Main) | New (Promoted from Preview) |
|
|
148
|
+
| -------------------- | ------------------------------------------ | ------------------------------------------------ |
|
|
149
|
+
| Variant | `variant` (`light`, `dark`) | `variant` (`blue`, `amber`, `teal`, `purple`) |
|
|
150
|
+
| Size | `size` (extraSmall=16px to extraExtraLarge=120px) | `size` (extraExtraSmall=24px to extraExtraLarge=120px) |
|
|
151
|
+
| User identifier | `altText` prop | `name` prop |
|
|
152
|
+
| Custom initials | Not supported | `preferredInitials` prop |
|
|
153
|
+
| Decorative mode | Not supported | `isDecorative` prop |
|
|
154
|
+
| Image URL | `url` prop | `url` prop |
|
|
155
|
+
| Object fit | `objectFit` prop | `objectFit` prop |
|
|
156
|
+
| Initials display | Not supported (shows user icon) | Shows initials from `name` when no image |
|
|
157
|
+
|
|
158
|
+
##### Size Mapping
|
|
159
|
+
|
|
160
|
+
| Size Name | Deprecated (Old Main) | New (Promoted from Preview) |
|
|
161
|
+
| ---------------- | --------------------- | --------------------------- |
|
|
162
|
+
| extraExtraSmall | - | 24px |
|
|
163
|
+
| extraSmall | 16px | 32px |
|
|
164
|
+
| small | 24px | 40px |
|
|
165
|
+
| medium | 32px | 48px |
|
|
166
|
+
| large | 40px | 72px |
|
|
167
|
+
| extraLarge | 64px | 96px |
|
|
168
|
+
| extraExtraLarge | 120px | 120px |
|
|
169
|
+
|
|
170
|
+
##### Code Migration
|
|
171
|
+
|
|
172
|
+
**Deprecated API (Old Main)**
|
|
173
|
+
|
|
174
|
+
```tsx
|
|
175
|
+
import {Avatar} from '@workday/canvas-kit-react/avatar';
|
|
176
|
+
|
|
177
|
+
<Avatar
|
|
178
|
+
size="medium"
|
|
179
|
+
variant="light"
|
|
180
|
+
url="https://example.com/photo.jpg"
|
|
181
|
+
altText="John Doe"
|
|
182
|
+
/>
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
**New API (v15)**
|
|
186
|
+
|
|
187
|
+
```tsx
|
|
188
|
+
import {Avatar} from '@workday/canvas-kit-react/avatar';
|
|
189
|
+
|
|
190
|
+
<Avatar
|
|
191
|
+
size="medium"
|
|
192
|
+
variant="blue"
|
|
193
|
+
url="https://example.com/photo.jpg"
|
|
194
|
+
name="John Doe"
|
|
195
|
+
/>
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
##### New Features
|
|
199
|
+
|
|
200
|
+
The promoted `Avatar` includes several new features:
|
|
201
|
+
|
|
202
|
+
- **Initials display**: Automatically shows initials from the `name` prop when no image URL is provided
|
|
203
|
+
- **Color variants**: Four color variants (`blue`, `amber`, `teal`, `purple`) instead of light/dark
|
|
204
|
+
- **Custom initials**: Use `preferredInitials` for full control over displayed initials
|
|
205
|
+
- **Decorative mode**: Use `isDecorative` when Avatar is purely decorative (rendered next to a name)
|
|
206
|
+
- **Compound components**: Build custom avatars using `BaseAvatar`, `BaseAvatar.Image`, and `BaseAvatar.Name`
|
|
207
|
+
- **Utility function**: Use `getInitialsFromName` to extract initials from a name string
|
|
208
|
+
|
|
209
|
+
```tsx
|
|
210
|
+
// With initials (no image)
|
|
211
|
+
<Avatar name="John Doe" variant="blue" />
|
|
212
|
+
|
|
213
|
+
// Custom initials
|
|
214
|
+
<Avatar name="John Doe" preferredInitials="JD" />
|
|
215
|
+
|
|
216
|
+
// Decorative (next to text name)
|
|
217
|
+
<Avatar name="John Doe" url="..." isDecorative />
|
|
218
|
+
|
|
219
|
+
// Using compound components for custom layouts
|
|
220
|
+
<BaseAvatar variant="teal" size="large">
|
|
221
|
+
<BaseAvatar.Image src="..." alt="John Doe" />
|
|
222
|
+
<BaseAvatar.Name name="John Doe" />
|
|
223
|
+
</BaseAvatar>
|
|
224
|
+
```
|
|
225
|
+
|
|
109
226
|
### Pill ⚡️
|
|
110
227
|
|
|
111
228
|
**PR** [#3634](https://github.com/Workday/canvas-kit/pull/3634)
|
|
@@ -264,6 +381,16 @@ tokens. These changes are **only visual**.
|
|
|
264
381
|
|
|
265
382
|
## Removals
|
|
266
383
|
|
|
384
|
+
### Avatar (Deprecated)
|
|
385
|
+
|
|
386
|
+
The deprecated `Avatar` that was previously in `@workday/canvas-kit-react/avatar`
|
|
387
|
+
has been removed. This was the older implementation that showed a user icon placeholder
|
|
388
|
+
and supported `light`/`dark` variants.
|
|
389
|
+
|
|
390
|
+
Please migrate to the new `Avatar` component (promoted from Preview) which uses initials
|
|
391
|
+
display, color variants (`blue`, `amber`, `teal`, `purple`), and supports compound components.
|
|
392
|
+
See the [API Differences](#api-differences) section above for migration guidance.
|
|
393
|
+
|
|
267
394
|
### Segmented Control (Deprecated)
|
|
268
395
|
|
|
269
396
|
The deprecated `SegmentedControl` that was previously in `@workday/canvas-kit-react/segmented-control`
|
|
@@ -96,7 +96,7 @@ const ProfileCard = ({id, name, bio}: ProfileCardProps) => (
|
|
|
96
96
|
<Avatar
|
|
97
97
|
size="extraLarge"
|
|
98
98
|
url={`https://avatars.githubusercontent.com/u/${id}?v=4`}
|
|
99
|
-
|
|
99
|
+
name={`${name}'s avatar`}
|
|
100
100
|
className={profileCardAvatarStyles}
|
|
101
101
|
/>
|
|
102
102
|
<h3 className={profileCardHeadingStyles}>{name}</h3>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {SymbolDoc, Specifications, ExampleCodeBlock} from '@workday/canvas-kit-docs';
|
|
1
|
+
import {SymbolDoc, Specifications, ExampleCodeBlock, StorybookStatusIndicator} from '@workday/canvas-kit-docs';
|
|
2
2
|
|
|
3
|
-
import {Avatar} from '@workday/canvas-kit-
|
|
3
|
+
import {Avatar} from '@workday/canvas-kit-react/avatar';
|
|
4
4
|
import Basic from './examples/Basic';
|
|
5
5
|
import Image from './examples/Image';
|
|
6
6
|
import Size from './examples/Size';
|
|
@@ -9,14 +9,12 @@ import Custom from './examples/Custom';
|
|
|
9
9
|
import Decorative from './examples/Decorative';
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
# Avatar
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
# Avatar <StorybookStatusIndicator type="promoted" />
|
|
15
13
|
|
|
16
14
|
## Installation
|
|
17
15
|
|
|
18
16
|
```sh
|
|
19
|
-
yarn add @workday/canvas-kit-
|
|
17
|
+
yarn add @workday/canvas-kit-react
|
|
20
18
|
```
|
|
21
19
|
|
|
22
20
|
|
|
@@ -77,4 +75,4 @@ If the Avatar is purely decorative, you can set the `isDecorative` prop to `true
|
|
|
77
75
|
|
|
78
76
|
## Component API
|
|
79
77
|
|
|
80
|
-
<SymbolDoc name="Avatar" fileName="/
|
|
78
|
+
<SymbolDoc name="Avatar" fileName="/react/" hideDescription />
|
|
@@ -28,14 +28,23 @@ const content = {
|
|
|
28
28
|
icon: undefined,
|
|
29
29
|
label: 'New',
|
|
30
30
|
},
|
|
31
|
+
promoted: {
|
|
32
|
+
icon: undefined,
|
|
33
|
+
label: 'Promoted',
|
|
34
|
+
},
|
|
31
35
|
};
|
|
32
36
|
|
|
33
|
-
export const StorybookStatusIndicator = ({
|
|
37
|
+
export const StorybookStatusIndicator = ({
|
|
38
|
+
type,
|
|
39
|
+
}: {
|
|
40
|
+
type: 'ai' | 'deprecated' | 'new' | 'promoted';
|
|
41
|
+
}) => {
|
|
34
42
|
const {icon, label} = content[type];
|
|
35
43
|
const variantMapping = {
|
|
36
44
|
ai: 'ai',
|
|
37
45
|
deprecated: 'caution',
|
|
38
46
|
new: 'positive',
|
|
47
|
+
promoted: 'info',
|
|
39
48
|
};
|
|
40
49
|
console.log(variantMapping[type]);
|
|
41
50
|
return (
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-docs",
|
|
3
|
-
"version": "15.0.0-alpha.
|
|
3
|
+
"version": "15.0.0-alpha.0077-next.0",
|
|
4
4
|
"description": "Documentation components of Canvas Kit components",
|
|
5
5
|
"author": "Workday, Inc. (https://www.workday.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
"@emotion/styled": "^11.6.0",
|
|
46
46
|
"@stackblitz/sdk": "^1.11.0",
|
|
47
47
|
"@storybook/csf": "0.0.1",
|
|
48
|
-
"@workday/canvas-kit-labs-react": "^15.0.0-alpha.
|
|
49
|
-
"@workday/canvas-kit-preview-react": "^15.0.0-alpha.
|
|
50
|
-
"@workday/canvas-kit-react": "^15.0.0-alpha.
|
|
51
|
-
"@workday/canvas-kit-styling": "^15.0.0-alpha.
|
|
48
|
+
"@workday/canvas-kit-labs-react": "^15.0.0-alpha.0077-next.0",
|
|
49
|
+
"@workday/canvas-kit-preview-react": "^15.0.0-alpha.0077-next.0",
|
|
50
|
+
"@workday/canvas-kit-react": "^15.0.0-alpha.0077-next.0",
|
|
51
|
+
"@workday/canvas-kit-styling": "^15.0.0-alpha.0077-next.0",
|
|
52
52
|
"@workday/canvas-system-icons-web": "^3.0.36",
|
|
53
53
|
"@workday/canvas-tokens-web": "4.0.0-alpha.3",
|
|
54
54
|
"markdown-to-jsx": "^7.2.0",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"mkdirp": "^1.0.3",
|
|
62
62
|
"typescript": "5.0"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "6944d028b6f1250481ad8c4f8d5f817bea4e01a1"
|
|
65
65
|
}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Specifications,
|
|
3
|
-
SymbolDoc,
|
|
4
|
-
SymbolDescription,
|
|
5
|
-
ExampleCodeBlock,
|
|
6
|
-
StorybookStatusIndicator,
|
|
7
|
-
} from '@workday/canvas-kit-docs';
|
|
8
|
-
import {InformationHighlight} from '@workday/canvas-kit-react/information-highlight';
|
|
9
|
-
|
|
10
|
-
import Basic from './examples/Basic';
|
|
11
|
-
import Button from './examples/Button';
|
|
12
|
-
import Image from './examples/Image';
|
|
13
|
-
import LazyLoad from './examples/LazyLoad';
|
|
14
|
-
import ObjectFit from './examples/ObjectFit';
|
|
15
|
-
import Size from './examples/Size';
|
|
16
|
-
import Variant from './examples/Variant';
|
|
17
|
-
import CustomStyles from './examples/CustomStyles';
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
# Canvas Kit Avatar <StorybookStatusIndicator type="deprecated" />
|
|
21
|
-
|
|
22
|
-
<InformationHighlight className="sb-unstyled" variant="caution" cs={{p: {marginBlock: 0}}}>
|
|
23
|
-
<InformationHighlight.Icon />
|
|
24
|
-
<InformationHighlight.Body>
|
|
25
|
-
`Avatar` in Main has been deprecated and will be removed in a future major version. Please use
|
|
26
|
-
[Avatar](https://workday.github.io/canvas-kit/?path=/docs/preview-avatar--docs) in Preview
|
|
27
|
-
instead.
|
|
28
|
-
</InformationHighlight.Body>
|
|
29
|
-
</InformationHighlight>
|
|
30
|
-
|
|
31
|
-
Represents a person's profile.
|
|
32
|
-
|
|
33
|
-
[> Workday Design Reference](https://canvas.workdaydesign.com/components/indicators/avatar)
|
|
34
|
-
|
|
35
|
-
## Installation
|
|
36
|
-
|
|
37
|
-
```sh
|
|
38
|
-
yarn add @workday/canvas-kit-react
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
## Usage
|
|
42
|
-
|
|
43
|
-
<SymbolDescription name="Avatar" fileName="/react/" />
|
|
44
|
-
|
|
45
|
-
The example below shows multiple instances of a `Avatar` with various configurations.
|
|
46
|
-
|
|
47
|
-
### Basic
|
|
48
|
-
|
|
49
|
-
By default, the Avatar renders a `button` element. If yo'd like to change the default element, use
|
|
50
|
-
the `as` prop.
|
|
51
|
-
|
|
52
|
-
<ExampleCodeBlock code={Basic} />
|
|
53
|
-
|
|
54
|
-
### Button
|
|
55
|
-
|
|
56
|
-
Like many of our components, Avatar accepts an `as` prop, which lets you change the underlying
|
|
57
|
-
semantic element to a `div`. This should be done with caution to ensure the best accessibility.
|
|
58
|
-
Generally, `<button>` elements should be used for actions.
|
|
59
|
-
|
|
60
|
-
<ExampleCodeBlock code={Button} />
|
|
61
|
-
|
|
62
|
-
### Variant
|
|
63
|
-
|
|
64
|
-
Avatar defaults to using a `"light"` `variant` property. You can change the `variant` prop to "dark"
|
|
65
|
-
by including `variant="dark"`.
|
|
66
|
-
|
|
67
|
-
<ExampleCodeBlock code={Variant} />
|
|
68
|
-
|
|
69
|
-
### Size
|
|
70
|
-
|
|
71
|
-
Avatar defaults to using a `"medium"` `size` property. You can change the `size` prop to various
|
|
72
|
-
sizing options. See Component API for more details.
|
|
73
|
-
|
|
74
|
-
Additionally, you can explicitly specify the size you want for the Avatar in pixels or rems.
|
|
75
|
-
|
|
76
|
-
<ExampleCodeBlock code={Size} />
|
|
77
|
-
|
|
78
|
-
### Image
|
|
79
|
-
|
|
80
|
-
Avatar renders an image when the `url` prop is defined.
|
|
81
|
-
|
|
82
|
-
<ExampleCodeBlock code={Image} />
|
|
83
|
-
|
|
84
|
-
### Object Fit
|
|
85
|
-
|
|
86
|
-
Avatar defaults to using `contain` for object-fit. You can change this property to any other
|
|
87
|
-
acceptable `object-fit` properties. For best fit, try to use square images.
|
|
88
|
-
|
|
89
|
-
<ExampleCodeBlock code={ObjectFit} />
|
|
90
|
-
|
|
91
|
-
### Lazy Load
|
|
92
|
-
|
|
93
|
-
Example of implementing lazy load behavior with Avatar.
|
|
94
|
-
|
|
95
|
-
<ExampleCodeBlock code={LazyLoad} />
|
|
96
|
-
|
|
97
|
-
### Custom Styling
|
|
98
|
-
|
|
99
|
-
To change the background color of the Avatar, you can use our `createStencil` functionality.
|
|
100
|
-
|
|
101
|
-
<ExampleCodeBlock code={CustomStyles} />
|
|
102
|
-
|
|
103
|
-
## Component API
|
|
104
|
-
|
|
105
|
-
<SymbolDoc name="Avatar" fileName="/react/" />
|
|
106
|
-
|
|
107
|
-
## Specifications
|
|
108
|
-
|
|
109
|
-
<Specifications file="Avatar.spec.ts" name="Avatar" />
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import {Avatar} from '@workday/canvas-kit-react/avatar';
|
|
2
|
-
import {createStyles} from '@workday/canvas-kit-styling';
|
|
3
|
-
import {system} from '@workday/canvas-tokens-web';
|
|
4
|
-
|
|
5
|
-
const handleAvatarButtonClick = () => console.log('AvatarButton clicked');
|
|
6
|
-
|
|
7
|
-
const containerStyles = createStyles({
|
|
8
|
-
display: 'inline-flex',
|
|
9
|
-
gap: system.space.x2,
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
export default () => (
|
|
13
|
-
<div className={containerStyles}>
|
|
14
|
-
<Avatar altText="Avatar" onClick={handleAvatarButtonClick} />
|
|
15
|
-
<Avatar altText="Avatar" as="div" />
|
|
16
|
-
</div>
|
|
17
|
-
);
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import {Avatar} from '@workday/canvas-kit-react/avatar';
|
|
2
|
-
import {createStyles} from '@workday/canvas-kit-styling';
|
|
3
|
-
import {system} from '@workday/canvas-tokens-web';
|
|
4
|
-
// @ts-ignore: Cannot find module error
|
|
5
|
-
import testAvatar from './test-avatar.png';
|
|
6
|
-
|
|
7
|
-
const handleAvatarButtonClick = () => console.log('AvatarButton clicked');
|
|
8
|
-
|
|
9
|
-
const containerStyles = createStyles({
|
|
10
|
-
display: 'inline-flex',
|
|
11
|
-
gap: system.space.x2,
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
export default () => (
|
|
15
|
-
<div className={containerStyles}>
|
|
16
|
-
<Avatar altText="Avatar" variant="dark" onClick={handleAvatarButtonClick} />
|
|
17
|
-
<Avatar altText="Avatar" onClick={handleAvatarButtonClick} />
|
|
18
|
-
<Avatar altText="Avatar" url={testAvatar} onClick={handleAvatarButtonClick} />
|
|
19
|
-
</div>
|
|
20
|
-
);
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import {Avatar} from '@workday/canvas-kit-react/avatar';
|
|
2
|
-
import {createStencil, createStyles} from '@workday/canvas-kit-styling';
|
|
3
|
-
import {system} from '@workday/canvas-tokens-web';
|
|
4
|
-
import {systemIconStencil} from '@workday/canvas-kit-react/icon';
|
|
5
|
-
|
|
6
|
-
const customOrangeAvatar = createStencil({
|
|
7
|
-
base: {
|
|
8
|
-
backgroundColor: system.color.static.amber.default,
|
|
9
|
-
['[data-part="avatar-icon"]']: {
|
|
10
|
-
[systemIconStencil.vars.color]: system.color.static.white,
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
const customGreenAvatarStencil = createStencil({
|
|
16
|
-
base: {
|
|
17
|
-
backgroundColor: system.color.static.green.default,
|
|
18
|
-
['[data-part="avatar-icon"]']: {
|
|
19
|
-
[systemIconStencil.vars.color]: system.color.static.white,
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
const containerStyles = createStyles({
|
|
25
|
-
display: 'inline-flex',
|
|
26
|
-
gap: system.space.x2,
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
export default () => (
|
|
30
|
-
<div className={containerStyles}>
|
|
31
|
-
<Avatar altText="Avatar" as="div" {...customOrangeAvatar()} />
|
|
32
|
-
<Avatar altText="Avatar" as="div" {...customGreenAvatarStencil()} />
|
|
33
|
-
</div>
|
|
34
|
-
);
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import {Avatar} from '@workday/canvas-kit-react/avatar';
|
|
2
|
-
// @ts-ignore: Cannot find module error
|
|
3
|
-
import testAvatar from './test-avatar.png';
|
|
4
|
-
import {createStyles} from '@workday/canvas-kit-styling';
|
|
5
|
-
import {system} from '@workday/canvas-tokens-web';
|
|
6
|
-
|
|
7
|
-
const containerStyles = createStyles({
|
|
8
|
-
display: 'flex',
|
|
9
|
-
flexDirection: 'column',
|
|
10
|
-
gap: system.space.x2,
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
export default () => (
|
|
14
|
-
<div className={containerStyles}>
|
|
15
|
-
<h3>Working Images</h3>
|
|
16
|
-
<Avatar altText="Avatar" size="extraExtraLarge" as="div" url={testAvatar} />
|
|
17
|
-
<Avatar altText="Avatar" size="extraLarge" as="div" url={testAvatar} />
|
|
18
|
-
<Avatar altText="Avatar" size="large" as="div" url={testAvatar} />
|
|
19
|
-
<Avatar altText="Avatar" size="medium" as="div" url={testAvatar} />
|
|
20
|
-
<Avatar altText="Avatar" size="small" as="div" url={testAvatar} />
|
|
21
|
-
<Avatar altText="Avatar" size="extraSmall" as="div" url={testAvatar} />
|
|
22
|
-
<h3>Broken Image</h3>
|
|
23
|
-
<Avatar altText="Avatar" url="/fake/path/to/image.png" as="div" />
|
|
24
|
-
</div>
|
|
25
|
-
);
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import {Avatar} from '@workday/canvas-kit-react/avatar';
|
|
2
|
-
// @ts-ignore: Cannot find module error
|
|
3
|
-
import testAvatar from './test-avatar.png';
|
|
4
|
-
|
|
5
|
-
export default () => (
|
|
6
|
-
<div className="story">
|
|
7
|
-
{Array.from({length: 5}, (v, index) => (
|
|
8
|
-
<div>
|
|
9
|
-
<Avatar
|
|
10
|
-
altText="Avatar"
|
|
11
|
-
key={index}
|
|
12
|
-
as="div"
|
|
13
|
-
size="medium"
|
|
14
|
-
url={testAvatar + '?v=' + index}
|
|
15
|
-
/>
|
|
16
|
-
<br />
|
|
17
|
-
</div>
|
|
18
|
-
))}
|
|
19
|
-
</div>
|
|
20
|
-
);
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import {Avatar} from '@workday/canvas-kit-react/avatar';
|
|
2
|
-
import {px2rem} from '@workday/canvas-kit-styling';
|
|
3
|
-
|
|
4
|
-
export default () => (
|
|
5
|
-
<div className="story">
|
|
6
|
-
<h3>Original Rectangle Image</h3>
|
|
7
|
-
<img alt="" src="https://picsum.photos/id/237/300/200" />
|
|
8
|
-
<h3>Object fit on a Rectangle Image</h3>
|
|
9
|
-
<Avatar altText="Avatar" as="div" url="https://picsum.photos/id/237/300/200" />
|
|
10
|
-
<h3>Object fit on a Rectangle Image using Dynamic Size</h3>
|
|
11
|
-
<Avatar
|
|
12
|
-
altText="Avatar"
|
|
13
|
-
as="div"
|
|
14
|
-
size={px2rem(200)}
|
|
15
|
-
url="https://picsum.photos/id/237/300/200"
|
|
16
|
-
objectFit="contain"
|
|
17
|
-
/>
|
|
18
|
-
<h3>Original Square Image</h3>
|
|
19
|
-
<img alt="" src="https://picsum.photos/id/237/300/300" />
|
|
20
|
-
<h3>Object fit on a Square Image</h3>
|
|
21
|
-
<Avatar altText="Avatar" as="div" url="https://picsum.photos/id/237/300/300" />
|
|
22
|
-
<h3>Object fit on a Square Image using Dynamic Size</h3>
|
|
23
|
-
<Avatar
|
|
24
|
-
altText="Avatar"
|
|
25
|
-
as="div"
|
|
26
|
-
size={px2rem(200)}
|
|
27
|
-
url="https://picsum.photos/id/237/300/300"
|
|
28
|
-
/>
|
|
29
|
-
</div>
|
|
30
|
-
);
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import {Avatar} from '@workday/canvas-kit-react/avatar';
|
|
2
|
-
import {px2rem} from '@workday/canvas-kit-styling';
|
|
3
|
-
|
|
4
|
-
export default () => (
|
|
5
|
-
<div className="story">
|
|
6
|
-
<h3>Extra-Extra Large</h3>
|
|
7
|
-
<Avatar altText="Avatar" as="div" size="extraExtraLarge" />
|
|
8
|
-
<h3>Extra Large</h3>
|
|
9
|
-
<Avatar altText="Avatar" as="div" size="extraLarge" />
|
|
10
|
-
<h3>Large</h3>
|
|
11
|
-
<Avatar altText="Avatar" as="div" size="large" />
|
|
12
|
-
<h3>Medium</h3>
|
|
13
|
-
<Avatar altText="Avatar" as="div" size="medium" />
|
|
14
|
-
<h3>Small</h3>
|
|
15
|
-
<Avatar altText="Avatar" as="div" size="small" />
|
|
16
|
-
<h3>Extra Small</h3>
|
|
17
|
-
<Avatar altText="Avatar" as="div" size="extraSmall" />
|
|
18
|
-
<h3>30px</h3>
|
|
19
|
-
<Avatar altText="Avatar" as="div" size={px2rem(30)} />
|
|
20
|
-
<h3>40px</h3>
|
|
21
|
-
<Avatar altText="Avatar" as="div" size={px2rem(40)} />
|
|
22
|
-
<h3>3rem</h3>
|
|
23
|
-
<Avatar altText="Avatar" as="div" size="3rem" />
|
|
24
|
-
<h3>4rem</h3>
|
|
25
|
-
<Avatar altText="Avatar" as="div" size="4rem" />
|
|
26
|
-
</div>
|
|
27
|
-
);
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import {Avatar} from '@workday/canvas-kit-react/avatar';
|
|
2
|
-
|
|
3
|
-
export default () => (
|
|
4
|
-
<div className="story">
|
|
5
|
-
<h3>Light</h3>
|
|
6
|
-
<Avatar altText="Avatar" as="div" size="medium" />
|
|
7
|
-
<h3>Dark</h3>
|
|
8
|
-
<Avatar altText="Avatar" as="div" size="medium" variant="dark" />
|
|
9
|
-
</div>
|
|
10
|
-
);
|
|
Binary file
|
|
File without changes
|