-
Notifications
You must be signed in to change notification settings - Fork 9
/
helpers.js
76 lines (72 loc) · 2.23 KB
/
helpers.js
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
import { buttonStyles } from './styles'
let defaultStyle = {}
let pressInStyle = {
borderColor: 'transparent',
borderBottomWidth: 0,
borderLeftWidth: 0,
borderRightWidth: 0
}
export const getDefaultStyle = (type, props) => {
switch (type) {
case "custom":
defaultStyle = {
borderRadius: props.borderRadius,
borderBottomWidth: props.shadowHeight,
backgroundColor: props.backgroundColor,
borderColor: props.borderColor,
borderLeftWidth: props.borderLeftWidth,
borderRightWidth: props.borderRightWidth
}
return defaultStyle
case "primary":
defaultStyle = buttonStyles.primary
return defaultStyle
case "neutral":
defaultStyle = buttonStyles.neutral
return defaultStyle
case "warn":
defaultStyle = buttonStyles.warn
return defaultStyle
case "negative":
defaultStyle = buttonStyles.negative
return defaultStyle
case "positive":
defaultStyle = buttonStyles.positive
return defaultStyle
case "info":
defaultStyle = buttonStyles.info
return defaultStyle
default:
defaultStyle = buttonStyles.primary
return defaultStyle
}
}
export const getPressInStyle = (type, backgroundColor, borderRadius) => {
switch (type) {
case "custom":
pressInStyle.backgroundColor = backgroundColor
pressInStyle.borderRadius = borderRadius
return pressInStyle
case "info":
pressInStyle.backgroundColor = buttonStyles.info.backgroundColor
return pressInStyle
case "negative":
pressInStyle.backgroundColor = buttonStyles.negative.backgroundColor
return pressInStyle
case "neutral":
pressInStyle.backgroundColor = buttonStyles.neutral.backgroundColor
return pressInStyle
case "positive":
pressInStyle.backgroundColor = buttonStyles.positive.backgroundColor
return pressInStyle
case "primary":
pressInStyle.backgroundColor = buttonStyles.primary.backgroundColor
return pressInStyle
case "warn":
pressInStyle.backgroundColor = buttonStyles.warn.backgroundColor
return pressInStyle
default:
pressInStyle.backgroundColor = buttonStyles.primary.backgroundColor
return pressInStyle
}
}