Skip to content

Commit b2f0141

Browse files
authored
fix(*-select-input): align indicator icons properly (#190)
fix(*-select-input): align indicator icons of clearable select-inputs
1 parent a6b4b3b commit b2f0141

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

src/components/internals/clear-indicator/clear-indicator.js

+17-6
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,23 @@ import React from 'react';
22
import PropTypes from 'prop-types';
33
import { CloseIcon } from '../../icons';
44

5-
const ClearIndicator = props => (
6-
<div className="react-select__clear-indicator" {...props.innerProps}>
7-
{/* FIXME: add proper tone when tones are refactored */}
8-
<CloseIcon theme={props.isDisabled && 'grey'} size="medium" />
9-
</div>
10-
);
5+
const ClearIndicator = props => {
6+
const {
7+
getStyles,
8+
innerProps: { ref, ...restInnerProps },
9+
} = props;
10+
return (
11+
<div
12+
{...restInnerProps}
13+
ref={ref}
14+
style={getStyles('clearIndicator', props)}
15+
>
16+
<div>
17+
<CloseIcon theme={props.isDisabled && 'grey'} size="medium" />
18+
</div>
19+
</div>
20+
);
21+
};
1122

1223
ClearIndicator.displayName = 'ClearIndicator';
1324

src/components/internals/create-select-styles.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ const indicatorSeparatorStyles = () => base => ({
7272
const dropdownIndicatorStyles = () => base => ({
7373
...base,
7474
color: vars['--token-font-color-default'],
75-
marginRight: vars['--spacing-8'],
7675
margin: '0',
7776
padding: '0',
7877
marginLeft: vars['--spacing-4'],
@@ -81,6 +80,7 @@ const dropdownIndicatorStyles = () => base => ({
8180
const clearIndicatorStyles = () => base => ({
8281
...base,
8382
display: 'flex',
83+
padding: 0,
8484
});
8585

8686
const menuListStyles = () => base => ({
@@ -192,6 +192,8 @@ const containerStyles = () => (base, state) => ({
192192

193193
const indicatorsContainerStyles = () => () => ({
194194
background: 'none',
195+
display: 'flex',
196+
alignItems: 'baseline',
195197
});
196198

197199
export default props => ({

src/components/internals/dropdown-indicator/dropdown-indicator.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { CaretDownIcon } from '../../icons';
66
const DropdownIndicator = props => (
77
<components.DropdownIndicator {...props}>
88
{/* FIXME: add proper tone when tones are refactored */}
9-
<CaretDownIcon theme={props.isDisabled && 'grey'} size="small" />
9+
<CaretDownIcon theme={props.isDisabled && 'grey'} size="medium" />
1010
</components.DropdownIndicator>
1111
);
1212

0 commit comments

Comments
 (0)