This repository was archived by the owner on Mar 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathbuttonStyles.ts
More file actions
99 lines (88 loc) · 2.56 KB
/
Copy pathbuttonStyles.ts
File metadata and controls
99 lines (88 loc) · 2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import { pxToRem } from '../../../../lib'
import { IComponentPartStylesInput, ICSSInJSStyle } from '../../../../../types/theme'
import { disabledStyle, truncateStyle } from '../../../../styles/customCSS'
const buttonStyles: IComponentPartStylesInput = {
root: ({ props, variables }: { props: any; variables: any }): ICSSInJSStyle => {
const { circular, disabled, fluid, type } = props
const primary = type === 'primary'
const secondary = type === 'secondary'
const {
height,
minWidth,
maxWidth,
color,
backgroundColor,
backgroundColorHover,
circularRadius,
paddingLeftRightValue,
typePrimaryColor,
typePrimaryBackgroundColor,
typePrimaryBackgroundColorHover,
typePrimaryBorderColor,
typeSecondaryColor,
typeSecondaryBackgroundColor,
typeSecondaryBackgroundColorHover,
typeSecondaryBorderColor,
} = variables
return {
height,
minWidth,
maxWidth,
color,
backgroundColor,
display: 'inline-flex',
justifyContent: 'center',
alignItems: 'center',
position: 'relative',
padding: `0 ${pxToRem(paddingLeftRightValue)}`,
margin: `0 ${pxToRem(8)} 0 0`,
verticalAlign: 'middle',
borderRadius: pxToRem(2),
borderWidth: `${secondary ? (circular ? 1 : 2) : 0}px`,
cursor: 'pointer',
':hover': {
backgroundColor: backgroundColorHover,
},
...(primary && {
color: typePrimaryColor,
backgroundColor: typePrimaryBackgroundColor,
borderColor: typePrimaryBorderColor,
':hover': {
color: typePrimaryColor,
backgroundColor: typePrimaryBackgroundColorHover,
},
}),
...(secondary && {
color: typeSecondaryColor,
backgroundColor: typeSecondaryBackgroundColor,
borderColor: typeSecondaryBorderColor,
':hover': {
color: typeSecondaryColor,
borderColor: 'transparent',
backgroundColor: typeSecondaryBackgroundColorHover,
},
}),
...(circular && {
minWidth: height,
padding: 0,
borderRadius: circularRadius,
}),
...(fluid && {
width: '100%',
maxWidth: '100%',
}),
...(disabled && {
...disabledStyle,
':hover': {
borderColor: undefined,
backgroundColor: undefined,
},
}),
}
},
content: ({ props }) => ({
overflow: 'hidden',
...(typeof props.content === 'string' && truncateStyle),
}),
}
export default buttonStyles