-
Notifications
You must be signed in to change notification settings - Fork 26
/
dropdown.styles.js
90 lines (81 loc) 路 2.04 KB
/
dropdown.styles.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import { css } from '@emotion/core';
import styled from '@emotion/styled';
import { customProperties as vars } from '@commercetools-uikit/design-system';
const DropdownItem = styled.button`
width: 100%;
border: 0;
font-size: 1rem;
cursor: pointer;
padding: ${vars.spacingXs} ${vars.spacingS};
font-family: ${vars.fontFamilyDefault};
display: block;
background-color: ${props =>
props.isSelected ? vars.colorAccent95 : vars.colorSurface};
&:focus,
&:hover {
outline: none;
background-color: ${vars.colorNeutral90};
}
`;
const getButtonStyles = (props = { isStyleButton: true }) => [
css`
border: 0;
font-family: ${vars.fontFamilyDefault};
border-radius: ${vars.borderRadius4};
cursor: pointer;
font-size: ${vars.fontSizeForInput};
color: ${vars.colorSolid};
display: flex;
justify-content: center;
align-items: center;
padding: ${props.isStyleButton
? `calc(${vars.spacingXs} - 1px) ${vars.spacingS}`
: vars.spacingXs};
&:hover {
background-color: ${vars.colorNeutral90};
}
`,
props.isIndeterminate &&
css`
background-color: ${vars.colorAccent95};
`,
props.isOpen &&
css`
&:not(:hover) {
background-color: ${vars.colorAccent30};
color: ${vars.colorSurface};
* {
fill: ${vars.colorSurface};
}
}
`,
props.isReadOnly &&
css`
color: ${vars.colorNeutral60};
* {
fill: ${vars.colorNeutral60};
}
`,
props.isDisabled &&
css`
color: ${vars.colorNeutral60};
* {
fill: ${vars.colorNeutral60};
}
`,
];
const DropdownContainer = styled.div`
position: absolute;
cursor: pointer;
font-size: ${vars.fontSizeForInput};
top: ${vars.spacingXs};
margin-top: ${vars.spacingXs};
left: 0;
white-space: nowrap;
background: ${vars.colorSurface};
overflow: hidden;
z-index: 9999;
border: 1px solid ${vars.colorPrimary};
border-radius: ${vars.borderRadius6};
`;
export { DropdownContainer, DropdownItem, getButtonStyles };