@workday/canvas-kit-docs 6.1.4 → 6.1.5
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.
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import {createComponent, styled, StyledType} from '@workday/canvas-kit-react/common';
|
|
4
|
+
import {colors, commonColors, depth, type, space} from '@workday/canvas-kit-react/tokens';
|
|
5
|
+
import {PrimaryButton, TertiaryButton} from '@workday/canvas-kit-react/button';
|
|
6
|
+
|
|
7
|
+
const CookieBannerItem = createComponent('div')({
|
|
8
|
+
displayName: 'CookieBanner.Item',
|
|
9
|
+
Component: ({isRow, ...elProps}: ItemProps, ref) => (
|
|
10
|
+
<BannerItem ref={ref} isRow={isRow} {...elProps} />
|
|
11
|
+
),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const CookieBanner = createComponent('div')({
|
|
15
|
+
displayName: 'CookieBanner',
|
|
16
|
+
Component: (props: BannerProps, ref, Element) => <Banner ref={ref} as={Element} {...props} />,
|
|
17
|
+
subComponents: {Item: CookieBannerItem},
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export default () => {
|
|
21
|
+
const DefaultNotice = `We use cookies to ensure that we give you the best experience on our website.
|
|
22
|
+
If you continue without changing your settings, we'll assume that you are willing to receive cookies.`;
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<ExampleContainer>
|
|
26
|
+
<CookieBanner isClosed={false}>
|
|
27
|
+
<CookieBanner.Item>{DefaultNotice}</CookieBanner.Item>
|
|
28
|
+
<CookieBanner.Item isRow>
|
|
29
|
+
<TertiaryButton>Settings</TertiaryButton>
|
|
30
|
+
<PrimaryButton>Continue</PrimaryButton>
|
|
31
|
+
</CookieBanner.Item>
|
|
32
|
+
</CookieBanner>
|
|
33
|
+
</ExampleContainer>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
interface BannerProps {
|
|
38
|
+
isClosed?: boolean;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface ItemProps {
|
|
42
|
+
isRow?: boolean;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const ExampleContainer = styled('div')({
|
|
46
|
+
minHeight: 84,
|
|
47
|
+
margin: space.xs,
|
|
48
|
+
position: 'relative',
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const Banner = styled('div')<BannerProps & StyledType>(
|
|
52
|
+
type.levels.subtext.medium,
|
|
53
|
+
{
|
|
54
|
+
backgroundColor: commonColors.background,
|
|
55
|
+
borderTop: `1px solid ${colors.soap400}`,
|
|
56
|
+
display: 'flex',
|
|
57
|
+
...depth[1],
|
|
58
|
+
padding: space.m,
|
|
59
|
+
alignItems: 'center',
|
|
60
|
+
justifyContent: 'space-between',
|
|
61
|
+
position: 'absolute',
|
|
62
|
+
bottom: 0,
|
|
63
|
+
left: 0,
|
|
64
|
+
right: 0,
|
|
65
|
+
zIndex: 99,
|
|
66
|
+
transition: 'transform 0.2s ease-out',
|
|
67
|
+
'@media (max-width: 450px)': {
|
|
68
|
+
flexDirection: 'column',
|
|
69
|
+
alignItems: 'stretch',
|
|
70
|
+
textAlign: 'center',
|
|
71
|
+
padding: `${space.s} 0`,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
({isClosed}) => isClosed && {transform: 'translateY(100%)'}
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
const BannerItem = styled('div')<ItemProps & StyledType>(
|
|
78
|
+
{
|
|
79
|
+
marginLeft: space.s,
|
|
80
|
+
marginRight: space.s,
|
|
81
|
+
'@media (max-width: 450px)': {
|
|
82
|
+
'&:not(:first-of-type)': {
|
|
83
|
+
marginTop: space.s,
|
|
84
|
+
'> *': {
|
|
85
|
+
flex: 1,
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
({isRow}) =>
|
|
91
|
+
isRow && {
|
|
92
|
+
display: 'flex',
|
|
93
|
+
'> *': {
|
|
94
|
+
marginLeft: space.s,
|
|
95
|
+
},
|
|
96
|
+
}
|
|
97
|
+
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-docs",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.5",
|
|
4
4
|
"description": "Documentation components of Canvas Kit components",
|
|
5
5
|
"author": "Workday, Inc. (https://www.workday.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
],
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@storybook/csf": "0.0.1",
|
|
53
|
-
"@workday/canvas-kit-react": "^6.1.
|
|
53
|
+
"@workday/canvas-kit-react": "^6.1.5"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"fs-extra": "^10.0.0",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"mkdirp": "^1.0.3",
|
|
59
59
|
"typescript": "^3.8.3"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "33b9994408c63b78923a201af73d8c2e6f7e5914"
|
|
62
62
|
}
|