Skip to content

Commit dde0294

Browse files
committed
Select: Make tiny size the default
1 parent 4f8015b commit dde0294

1 file changed

Lines changed: 27 additions & 35 deletions

File tree

src/components/select/index.js

Lines changed: 27 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,10 @@ const getOptionBackground = (theme, state) => {
181181
return null
182182
}
183183

184-
const makeCustomStyles = (theme, { minWidth, size, ...providedStyles } = {}) => ({
184+
const fontSize = "12px"
185+
const lineHeight = "16px"
186+
187+
const makeCustomStyles = (theme, { minWidth, ...providedStyles } = {}) => ({
185188
control: (styles, state) => ({
186189
...styles,
187190
borderColor: state.isFocused ? theme.colors.inputBorderFocus : theme.colors.inputBorder,
@@ -196,28 +199,25 @@ const makeCustomStyles = (theme, { minWidth, size, ...providedStyles } = {}) =>
196199
input: (styles, state) => ({
197200
...styles,
198201
color: state.isDisabled ? theme.colors.placeholder : theme.colors.grey140,
199-
...(size === "tiny"
200-
? {
201-
lineHeight: "18px",
202-
paddingBottom: 0,
203-
paddingTop: 0,
204-
}
205-
: {}),
202+
fontSize,
203+
lineHeight,
204+
paddingBottom: 0,
205+
paddingTop: 0,
206206
}),
207207
menu: styles => ({ ...styles, borderRadius: "2px", zIndex: 100 }),
208208
menuPortal: styles => ({ ...styles, zIndex: 9999 }),
209209
multiValue: styles => ({
210210
...styles,
211-
fontSize: size === "tiny" ? "12px" : "14px",
211+
fontSize,
212212
flexDirection: "row-reverse",
213-
...(size === "tiny" ? { minHeight: 18 } : {}),
213+
minHeight: 18,
214214
}),
215215
multiValueLabel: (styles, state) => ({
216216
...styles,
217217
backgroundColor: theme.colors.grey40,
218218
borderRadius: "0 2px 2px 0",
219219
color: state.isDisabled ? theme.colors.placeholder : theme.colors.grey140,
220-
...(size === "tiny" ? { padding: "1px" } : {}),
220+
padding: "1px",
221221
paddingRight: state.data.isDisabled ? "8px" : "",
222222
}),
223223
multiValueRemove: (styles, state) => ({
@@ -243,39 +243,31 @@ const makeCustomStyles = (theme, { minWidth, size, ...providedStyles } = {}) =>
243243
backgroundColor: theme.colors.secondaryHighlight,
244244
color: theme.colors.text,
245245
},
246-
...(size === "tiny" ? { fontSize: "12px", minHeight: 28, padding: "4px 8px" } : {}),
246+
fontSize,
247+
lineHeight,
248+
minHeight: 28,
249+
padding: "4px 8px",
247250
}),
248251
placeholder: styles => ({
249252
...styles,
250253
color: theme.colors.placeholder,
251-
...(size === "tiny" ? { fontSize: "12px", lineHeight: "18px" } : {}),
254+
fontSize,
255+
lineHeight,
252256
}),
253257
singleValue: (styles, state) => ({
254258
...styles,
255259
color: state.isDisabled ? theme.colors.placeholder : theme.colors.grey140,
256-
fontSize: size === "tiny" ? "12px" : "14px",
260+
fontSize,
261+
lineHeight,
262+
}),
263+
indicatorsContainer: styles => ({ ...styles, minHeight: 18 }),
264+
dropdownIndicator: styles => ({ ...styles, padding: "1px" }),
265+
clearIndicator: styles => ({ ...styles, padding: "1px" }),
266+
valueContainer: styles => ({
267+
...styles,
268+
minHeight: 18,
269+
padding: "0px 6px",
257270
}),
258-
...(size === "tiny"
259-
? {
260-
dropdownIndicator: styles => ({ ...styles, padding: "3px" }),
261-
clearIndicator: styles => ({ ...styles, padding: "3px" }),
262-
indicatorsContainer: styles => ({ ...styles, minHeight: 18 }),
263-
valueContainer: styles => ({
264-
...styles,
265-
minHeight: 18,
266-
padding: "1px 6px",
267-
}),
268-
}
269-
: {
270-
dropdownIndicator: styles => ({ ...styles, padding: "3px" }),
271-
clearIndicator: styles => ({ ...styles, padding: "3px" }),
272-
indicatorsContainer: styles => ({ ...styles, minHeight: 28 }),
273-
valueContainer: styles => ({
274-
...styles,
275-
minHeight: 28,
276-
padding: "1px 6px",
277-
}),
278-
}),
279271
...providedStyles,
280272
})
281273

0 commit comments

Comments
 (0)