@workday/canvas-kit-docs 7.3.7 → 7.3.8
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.
|
@@ -13,6 +13,7 @@ import SecondaryInverse from './examples/SecondaryInverse';
|
|
|
13
13
|
import Tertiary from './examples/Tertiary';
|
|
14
14
|
import TertiaryInverse from './examples/TertiaryInverse';
|
|
15
15
|
import Delete from './examples/Delete';
|
|
16
|
+
import CustomStyles from './examples/CustomStyles';
|
|
16
17
|
|
|
17
18
|
|
|
18
19
|
# Canvas Kit Button
|
|
@@ -114,6 +115,15 @@ Undocumented props are spread to the underlying `<button>` element.
|
|
|
114
115
|
|
|
115
116
|
<ArgsTable of={DeleteButton} />
|
|
116
117
|
|
|
118
|
+
### Custom Styles
|
|
119
|
+
|
|
120
|
+
We understand that there are instances in which consumers might need to adjust styles for specific
|
|
121
|
+
use cases. All of our buttons extend our lower level base button props which extends style
|
|
122
|
+
properties that come from `Box`. Below are some examples in which you can overwrite styles for all
|
|
123
|
+
of our buttons. Please use this sparaingly and try to adhere to the design system.
|
|
124
|
+
|
|
125
|
+
<ExampleCodeBlock code={CustomStyles} />
|
|
126
|
+
|
|
117
127
|
### Accessible Use of the `as` Prop
|
|
118
128
|
|
|
119
129
|
Like many of our components, Buttons accept an `as` prop, which lets you change the underlying
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import {PrimaryButton} from '@workday/canvas-kit-react/button';
|
|
4
|
+
import {HStack} from '@workday/canvas-kit-react/layout';
|
|
5
|
+
import {plusIcon, caretDownIcon} from '@workday/canvas-system-icons-web';
|
|
6
|
+
import {space, colors} from '@workday/canvas-kit-react/tokens';
|
|
7
|
+
import {CanvasProvider} from '@workday/canvas-kit-react/common';
|
|
8
|
+
import {customColorTheme} from '../../../../../../utils/storybook';
|
|
9
|
+
import styled from '@emotion/styled';
|
|
10
|
+
|
|
11
|
+
const getDropdownColors = () => {
|
|
12
|
+
return {
|
|
13
|
+
default: {
|
|
14
|
+
background: colors.berrySmoothie400,
|
|
15
|
+
icon: colors.frenchVanilla100,
|
|
16
|
+
label: colors.frenchVanilla100,
|
|
17
|
+
},
|
|
18
|
+
hover: {
|
|
19
|
+
background: colors.berrySmoothie500,
|
|
20
|
+
label: colors.frenchVanilla100,
|
|
21
|
+
},
|
|
22
|
+
active: {},
|
|
23
|
+
focus: {},
|
|
24
|
+
disabled: {},
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const StyledPrimaryButton = styled(PrimaryButton)({
|
|
29
|
+
height: space.l,
|
|
30
|
+
padding: space.xxs,
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export default () => (
|
|
34
|
+
<HStack spacing="s" padding="s">
|
|
35
|
+
<PrimaryButton
|
|
36
|
+
padding={space.l}
|
|
37
|
+
border="3px dotted red"
|
|
38
|
+
backgroundColor="cyan"
|
|
39
|
+
color={colors.blackPepper400}
|
|
40
|
+
>
|
|
41
|
+
Styled with style properties
|
|
42
|
+
</PrimaryButton>
|
|
43
|
+
<PrimaryButton colors={getDropdownColors()} icon={plusIcon} iconPosition="start">
|
|
44
|
+
Styled with colors prop
|
|
45
|
+
</PrimaryButton>
|
|
46
|
+
<StyledPrimaryButton icon={caretDownIcon} iconPosition="end">
|
|
47
|
+
Overwrite styles with emotion
|
|
48
|
+
</StyledPrimaryButton>
|
|
49
|
+
<CanvasProvider theme={{canvas: customColorTheme}}>
|
|
50
|
+
<PrimaryButton>Custom Theme</PrimaryButton>
|
|
51
|
+
</CanvasProvider>
|
|
52
|
+
</HStack>
|
|
53
|
+
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-docs",
|
|
3
|
-
"version": "7.3.
|
|
3
|
+
"version": "7.3.8",
|
|
4
4
|
"description": "Documentation components of Canvas Kit components",
|
|
5
5
|
"author": "Workday, Inc. (https://www.workday.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@storybook/csf": "0.0.1",
|
|
45
|
-
"@workday/canvas-kit-react": "^7.3.
|
|
45
|
+
"@workday/canvas-kit-react": "^7.3.8"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"fs-extra": "^10.0.0",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"mkdirp": "^1.0.3",
|
|
51
51
|
"typescript": "4.1"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "bd507e1dce38a8325c0e4eedd45c2987a00a6299"
|
|
54
54
|
}
|