Merge pull request #964 from soknaly/fix/dropdown-style

fix: Update Dropdown (react-select) style
This commit is contained in:
Simon Larsen
2023-11-26 11:54:20 +00:00
committed by GitHub

View File

@@ -1,4 +1,4 @@
import Select from 'react-select';
import Select, { ControlProps, GroupBase, OptionProps } from 'react-select';
import React, {
FunctionComponent,
ReactElement,
@@ -126,6 +126,29 @@ const Dropdown: FunctionComponent<ComponentProps> = (
onFocus={() => {
props.onFocus && props.onFocus();
}}
classNames={{
control: (
state: ControlProps<any, boolean, GroupBase<any>>
): string => {
return state.isFocused
? '!border-indigo-500'
: 'border-grey-300';
},
option: (
state: OptionProps<any, boolean, GroupBase<any>>
): string => {
if (state.isDisabled) {
return 'bg-gray-100';
}
if (state.isSelected) {
return '!bg-indigo-500';
}
if (state.isFocused) {
return '!bg-indigo-100';
}
return '';
},
}}
isClearable={true}
isSearchable={true}
placeholder={props.placeholder}