@@ -2,6 +2,8 @@ import React, { useMemo } from "react"
22import styled from "styled-components"
33import ReactSelect , { components as defaultComponents } from "react-select"
44import Creatable from "react-select/creatable"
5+ import { Icon } from "@/components/icon"
6+ import { TextSmall } from "@/components/typography"
57
68const useDataAttrs = ( props , name ) => {
79 const { "data-ga" : dataGA , "data-testid" : dataTestId } = props . selectProps
@@ -38,6 +40,21 @@ const withDOMDataAttrs = (Component, name) => props => {
3840 return < Component { ...props } { ...dataProps } />
3941}
4042
43+ const OriginalOption = defaultComponents . Option
44+
45+ const Option = props => {
46+ if ( props . data . icon ) {
47+ return (
48+ < OriginalOption { ...props } >
49+ < Icon name = { props . data . icon } color = "textLite" margin = { [ 0 , 1 , 0 , 0 ] } />
50+ < span > { props . data . label } </ span >
51+ </ OriginalOption >
52+ )
53+ }
54+
55+ return < OriginalOption { ...props } />
56+ }
57+
4158const customComponents = {
4259 ...defaultComponents ,
4360 ClearIndicator : withDataAttrs ( defaultComponents . ClearIndicator , "ClearIndicator" ) ,
@@ -60,7 +77,7 @@ const customComponents = {
6077 MultiValueLabel : withDataAttrs ( defaultComponents . MultiValueLabel , "MultiValueLabel" ) ,
6178 MultiValueRemove : withDataAttrs ( defaultComponents . MultiValueRemove , "MultiValueRemove" ) ,
6279 NoOptionsMessage : withDataAttrs ( defaultComponents . NoOptionsMessage , "NoOptionsMessage" ) ,
63- Option : withDataAttrs ( defaultComponents . Option , "Option" ) ,
80+ Option : withDataAttrs ( Option , "Option" ) ,
6481 Placeholder : withDataAttrs ( defaultComponents . Placeholder , "Placeholder" ) ,
6582 SelectContainer : withDataAttrs ( defaultComponents . SelectContainer , "SelectContainer" ) ,
6683 SingleValue : withDataAttrs ( defaultComponents . SingleValue , "SingleValue" ) ,
@@ -92,7 +109,7 @@ const makeCustomTheme = theme => selectTheme => {
92109
93110const getOptionColor = ( theme , state ) => {
94111 if ( state . isDisabled ) return theme . colors . placeholder
95- if ( state . isSelected ) return theme . colors . bright
112+ if ( state . isSelected ) return theme . colors . text
96113 return theme . colors . textDescription
97114}
98115
@@ -149,10 +166,12 @@ const makeCustomStyles = (theme, { minWidth, size, ...providedStyles } = {}) =>
149166 } ) ,
150167 option : ( styles , state ) => ( {
151168 ...styles ,
169+ display : "flex" ,
170+ alignItems : "center" ,
152171 color : getOptionColor ( theme , state ) ,
153172 ":hover" : {
154- backgroundColor : theme . colors . dropdown ,
155- color : theme . colors . bright ,
173+ backgroundColor : theme . colors . secondaryHighlight ,
174+ color : theme . colors . text ,
156175 } ,
157176 ...( size === "tiny" ? { fontSize : "12px" , minHeight : 28 , padding : "4px 8px" } : { } ) ,
158177 } ) ,
0 commit comments