@workday/canvas-kit-docs 6.0.5 → 6.0.6
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/mdx/6.0-MIGRATION-GUIDE.mdx +6 -0
- package/dist/mdx/react/_examples/GlobalHeader.mdx +9 -0
- package/dist/mdx/react/_examples/PageHeader.mdx +8 -0
- package/dist/mdx/react/_examples/examples/GlobalHeader.tsx +66 -0
- package/dist/mdx/react/_examples/examples/PageHeader.tsx +63 -0
- package/package.json +3 -3
|
@@ -216,6 +216,9 @@ const CustomGlobalHeader = props => {
|
|
|
216
216
|
};
|
|
217
217
|
```
|
|
218
218
|
|
|
219
|
+
You may continue to use this component exactly as you did in v5, but note that we plan to hard-deprecate it in Canvas Kit v7.
|
|
220
|
+
If you would like to migrate away from this deprecated component now, you can reference [this example](https://workday.github.io/canvas-kit/?path=/story/examples-global-header-react--basic) instead.
|
|
221
|
+
|
|
219
222
|
### Page Header
|
|
220
223
|
|
|
221
224
|
We are [soft-deprecating](#soft-deprecation) `PageHeader`. It has been renamed to
|
|
@@ -267,6 +270,9 @@ export const CustomPageHeader = (props: CustomPageHeaderProps) => {
|
|
|
267
270
|
};
|
|
268
271
|
```
|
|
269
272
|
|
|
273
|
+
You may continue to use this component exactly as you did in v5, but note that we plan to hard-deprecate it in Canvas Kit v7.
|
|
274
|
+
If you would like to migrate away from this deprecated component now, you can reference [this example](https://workday.github.io/canvas-kit/?path=/story/examples-page-header-react--basic) instead.
|
|
275
|
+
|
|
270
276
|
## Component Migrations
|
|
271
277
|
|
|
272
278
|
### Search Bar
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import Basic from './examples/GlobalHeader';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
# Canvas Kit Examples
|
|
5
|
+
|
|
6
|
+
## GlobalHeader
|
|
7
|
+
Developers building internal Workday applications will likely not need to create this component. However, if you're building components to be used outside of Workday, this is a helpful reference for building a global navigation header that looks like our internal `GlobalHeader`.
|
|
8
|
+
|
|
9
|
+
<ExampleCodeBlock code={Basic} />
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import {styled, createComponent, dubLogoBlue} from '@workday/canvas-kit-react/common';
|
|
3
|
+
import {colors, depth, space, type} from '@workday/canvas-kit-react/tokens';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
notificationsIcon,
|
|
7
|
+
inboxIcon,
|
|
8
|
+
justifyIcon,
|
|
9
|
+
assistantIcon,
|
|
10
|
+
} from '@workday/canvas-system-icons-web';
|
|
11
|
+
|
|
12
|
+
import {IconButton, Hyperlink} from '@workday/canvas-kit-react/button';
|
|
13
|
+
import {Avatar} from '@workday/canvas-kit-react/avatar';
|
|
14
|
+
import {SearchForm, HStack, HStackProps, StackSpacing} from '@workday/canvas-kit-labs-react';
|
|
15
|
+
|
|
16
|
+
interface HeaderItemProps extends Omit<HStackProps, 'spacing'> {
|
|
17
|
+
spacing?: StackSpacing;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default () => (
|
|
21
|
+
<GlobalHeader>
|
|
22
|
+
<GlobalHeader.Item>
|
|
23
|
+
<IconButton aria-label="menu" icon={justifyIcon} />
|
|
24
|
+
<Hyperlink>
|
|
25
|
+
<WorkdayLogo dangerouslySetInnerHTML={{__html: dubLogoBlue}} />
|
|
26
|
+
</Hyperlink>
|
|
27
|
+
</GlobalHeader.Item>
|
|
28
|
+
<GlobalHeader.Item margin="auto" width="100%" maxWidth={`calc(${space.xxxl} * 6)`}>
|
|
29
|
+
<SearchForm onSubmit={() => 1} />
|
|
30
|
+
</GlobalHeader.Item>
|
|
31
|
+
<GlobalHeader.Item>
|
|
32
|
+
<IconButton aria-label="messages" icon={assistantIcon} />
|
|
33
|
+
<IconButton aria-label="notifications" icon={notificationsIcon} />
|
|
34
|
+
<IconButton aria-label="inbox" icon={inboxIcon} />
|
|
35
|
+
<Avatar size={Avatar.Size.m} variant={Avatar.Variant.Light} />
|
|
36
|
+
</GlobalHeader.Item>
|
|
37
|
+
</GlobalHeader>
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
const GlobalHeaderItem = createComponent('div')({
|
|
41
|
+
displayName: 'GlobalHeader.Item',
|
|
42
|
+
Component: ({spacing = 's', ...props}: HeaderItemProps, ref) => (
|
|
43
|
+
<HStack spacing={spacing} alignItems="center" marginX={space.xs} ref={ref} {...props} />
|
|
44
|
+
),
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const GlobalHeader = createComponent('header')({
|
|
48
|
+
displayName: 'GlobalHeader',
|
|
49
|
+
Component: (props, ref, Element) => <HeaderWrapper ref={ref} as={Element} {...props} />,
|
|
50
|
+
subComponents: {Item: GlobalHeaderItem},
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const HeaderWrapper = styled('header')({
|
|
54
|
+
display: 'flex',
|
|
55
|
+
alignItems: 'center',
|
|
56
|
+
justifyContent: 'space-between',
|
|
57
|
+
boxSizing: 'border-box',
|
|
58
|
+
...type.levels.subtext.large,
|
|
59
|
+
WebkitFontSmoothing: 'antialiased',
|
|
60
|
+
MozOsxFontSmoothing: 'grayscale',
|
|
61
|
+
backgroundColor: colors.frenchVanilla100,
|
|
62
|
+
...depth[1],
|
|
63
|
+
padding: space.xxs,
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
const WorkdayLogo = styled('span')({lineHeight: 0});
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import {styled, createComponent} from '@workday/canvas-kit-react/common';
|
|
3
|
+
|
|
4
|
+
import {colors, gradients, space, type} from '@workday/canvas-kit-react/tokens';
|
|
5
|
+
|
|
6
|
+
import {HStack, HStackProps, StackSpacing} from '@workday/canvas-kit-labs-react';
|
|
7
|
+
import {IconButton} from '@workday/canvas-kit-react/button';
|
|
8
|
+
import {justifyIcon, notificationsIcon} from '@workday/canvas-system-icons-web';
|
|
9
|
+
|
|
10
|
+
interface HeaderItemProps extends Omit<HStackProps, 'spacing'> {
|
|
11
|
+
spacing?: StackSpacing;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default () => (
|
|
15
|
+
<PageHeader>
|
|
16
|
+
<PageHeader.Title>Page Header</PageHeader.Title>
|
|
17
|
+
<PageHeader.Item>
|
|
18
|
+
<IconButton aria-label="notifications" icon={notificationsIcon} variant="inverse" />
|
|
19
|
+
<IconButton aria-label="menu" icon={justifyIcon} variant="inverse" />
|
|
20
|
+
</PageHeader.Item>
|
|
21
|
+
</PageHeader>
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
const PageHeaderItem = createComponent('div')({
|
|
25
|
+
displayName: 'PageHeader.Item',
|
|
26
|
+
Component: ({spacing = 'xxs', ...props}: HeaderItemProps, ref, Element) => (
|
|
27
|
+
<HStack spacing={spacing} ref={ref} as={Element} {...props} />
|
|
28
|
+
),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const PageHeaderTitle = createComponent('h2')({
|
|
32
|
+
displayName: 'PageHeader.Title',
|
|
33
|
+
Component: ({children, ...props}, ref, Element) => (
|
|
34
|
+
<Title ref={ref} as={Element} {...props}>
|
|
35
|
+
{children}
|
|
36
|
+
</Title>
|
|
37
|
+
),
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const PageHeader = createComponent('header')({
|
|
41
|
+
displayName: 'PageHeader',
|
|
42
|
+
Component: (props, ref, Element) => <Header ref={ref} as={Element} {...props} />,
|
|
43
|
+
subComponents: {Item: PageHeaderItem, Title: PageHeaderTitle},
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const Header = styled('header')({
|
|
47
|
+
padding: `${space.xs} ${space.xl}`,
|
|
48
|
+
backgroundImage: gradients.blueberry,
|
|
49
|
+
color: colors.frenchVanilla100,
|
|
50
|
+
WebkitFontSmoothing: 'antialiased',
|
|
51
|
+
MozOsxFontSmoothing: 'grayscale',
|
|
52
|
+
display: 'flex',
|
|
53
|
+
alignItems: 'center',
|
|
54
|
+
justifyContent: 'space-between',
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const Title = styled('h2')({
|
|
58
|
+
...type.levels.heading.medium,
|
|
59
|
+
color: colors.frenchVanilla100,
|
|
60
|
+
padding: `${space.xs} 0`,
|
|
61
|
+
margin: 0,
|
|
62
|
+
whiteSpace: 'nowrap',
|
|
63
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-docs",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.6",
|
|
4
4
|
"description": "Documentation components of Canvas Kit components",
|
|
5
5
|
"author": "Workday, Inc. (https://www.workday.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
],
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@storybook/csf": "0.0.1",
|
|
52
|
-
"@workday/canvas-kit-react": "^6.0.
|
|
52
|
+
"@workday/canvas-kit-react": "^6.0.6"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"fs-extra": "^10.0.0",
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"mkdirp": "^1.0.3",
|
|
58
58
|
"typescript": "^3.8.3"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "f4290c84ed12119c110a549db106e250e746553d"
|
|
61
61
|
}
|