Skip to content

Commit 0b4a907

Browse files
committed
feat: Adjust style for old component Field and SelectBox
1 parent 22e8e7d commit 0b4a907

File tree

4 files changed

+165
-138
lines changed

4 files changed

+165
-138
lines changed

react/SelectBox/SelectBox.jsx

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { isIOSApp } from 'cozy-device-helper'
77

88
import Icon from '../Icon'
99
import CheckIcon from '../Icons/Check'
10-
import { dodgerBlue, silver, coolGrey, paleGrey } from '../palette'
1110
import withBreakpoints from '../helpers/withBreakpoints'
1211
import TopIcon from '../Icons/Top'
1312
import BottomIcon from '../Icons/Bottom'
@@ -23,28 +22,40 @@ const heights = {
2322

2423
const borderStyle = (props, state) => {
2524
if (props.inset) {
26-
return '.125rem solid white'
25+
return '.125rem solid var(--paperBackgroundColor)'
2726
}
28-
return `.0625rem solid ${state.isFocused ? dodgerBlue : silver}`
27+
return `.0625rem solid ${
28+
state.isFocused ? 'var(--primaryColor)' : 'var(--borderMainColor)'
29+
}`
2930
}
3031

3132
const customStyles = props => ({
3233
control: (base, state) => ({
3334
...base,
3435
// The gray background color is managed via the select--disabled
3536
// class applied below
36-
backgroundColor: props.disabled ? 'transparent' : 'white',
37+
backgroundColor: props.disabled
38+
? 'transparent'
39+
: 'var(--paperBackgroundColor)',
3740
border: borderStyle(props, state),
3841
':hover': {
39-
borderColor: props.inset ? 'white' : coolGrey,
40-
backgroundColor: props.inset ? paleGrey : 'white',
42+
borderColor: props.inset
43+
? 'var(--paperBackgroundColor)'
44+
: 'var(--hintTextColor)',
45+
backgroundColor: props.inset
46+
? 'var(--defaultBackgroundColor)'
47+
: 'var(--paperBackgroundColor)',
4148
cursor: 'pointer'
4249
},
4350
borderRadius: '.1875rem',
4451
boxShadow: 'unset',
4552
height: heights[props.size],
4653
minHeight: heights[props.size]
4754
}),
55+
placeholder: base => ({
56+
...base,
57+
color: 'var(--secondaryTextColor)'
58+
}),
4859
dropdownIndicator: base => ({
4960
...base,
5061
marginRight: '.75rem',
@@ -57,10 +68,19 @@ const customStyles = props => ({
5768
}),
5869
valueContainer: base => ({
5970
...base,
60-
color: 'black'
71+
color: 'var(--primaryTextColor)'
72+
}),
73+
singleValue: base => ({
74+
...base,
75+
color: 'var(--primaryTextColor)'
76+
}),
77+
multiValue: base => ({
78+
...base,
79+
backgroundColor: 'var(--hintTextColor)'
6180
}),
6281
menu: base => ({
6382
...base,
83+
backgroundColor: 'var(--paperBackgroundColor)',
6484
zIndex: 10
6585
})
6686
})
@@ -103,7 +123,7 @@ const DropdownIndicator = props => {
103123
<components.DropdownIndicator {...props}>
104124
<Icon
105125
icon={props.selectProps.menuIsOpen ? TopIcon : BottomIcon}
106-
color={coolGrey}
126+
color="var(--iconTextColor)"
107127
width="20"
108128
height="16"
109129
/>
@@ -158,7 +178,11 @@ const Option = ({
158178
{!withCheckbox && (
159179
<span className={styles['select-option__checkmark']}>
160180
{isSelected && (
161-
<Icon icon={CheckIcon} color={dodgerBlue} className="u-ph-half" />
181+
<Icon
182+
icon={CheckIcon}
183+
color="var(--primaryColor)"
184+
className="u-ph-half"
185+
/>
162186
)}
163187
</span>
164188
)}
@@ -186,7 +210,9 @@ const ActionsOption = ({ actions, ...props }) => (
186210
{...action.iconProps}
187211
key={index}
188212
icon={action.icon}
189-
color={props.isFocused ? coolGrey : silver}
213+
color={
214+
props.isFocused ? 'var(--iconTextColor)' : 'var(--hintTextColor)'
215+
}
190216
className="u-ph-half"
191217
onClick={e => {
192218
e.stopPropagation()

react/SelectBox/styles.styl

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,27 @@
2424
align-items center
2525
padding rem(8)
2626
border-left rem(4) solid transparent
27-
color var(--charcoalGrey)
27+
color var(--primaryTextColor)
28+
background-color var(--paperBackgroundColor)
2829
transition all .2s ease-out
2930
white-space normal /* otherwise the tick can be wrongly placed in Firefox */
3031

3132
&:hover:not(.select-option--disabled)
32-
background-color var(--paleGrey)
33+
background-color var(--actionColorSelected)
3334
cursor pointer
3435

3536
.select-option__actions
3637
opacity 1
3738

3839
.select-option--focused:not(.select-option--disabled)
39-
background-color var(--paleGrey)
40+
background-color var(--actionColorHover)
4041

4142
.select-option--selected
42-
background-color var(--paleGrey)
43+
background-color var(--actionColorSelected)
4344
border-left-color var(--primaryColor)
4445

4546
.select-option--disabled
46-
color var(--silver)
47+
color var(--disabledTextColor)
4748
cursor not-allowed
4849

4950
.select-option__checkbox
@@ -94,4 +95,4 @@
9495
.FixedGroup
9596
@extend .Group
9697
flex-shrink 0
97-
border-top silver 1px solid
98+
border-top 1px solid var(--borderMainColor)

0 commit comments

Comments
 (0)