mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-09-13 06:36:49 -05:00
custom filter option (#397)
This commit is contained in:
@@ -45,6 +45,14 @@ const DropdownIndicator = (props: any) => {
|
||||
);
|
||||
};
|
||||
|
||||
const customFilterOption = (option: any, rawInput: string) => {
|
||||
const words = rawInput.split(" ");
|
||||
return words.reduce(
|
||||
(acc, cur) => acc && option.label.toLowerCase().includes(cur.toLowerCase()),
|
||||
true
|
||||
);
|
||||
};
|
||||
|
||||
const MySelect: React.FC<SelectProps> = ({
|
||||
options,
|
||||
components,
|
||||
@@ -105,6 +113,7 @@ const MySelect: React.FC<SelectProps> = ({
|
||||
isDisabled={isDisabled}
|
||||
isClearable={isClearable}
|
||||
options={options}
|
||||
filterOption={customFilterOption}
|
||||
components={
|
||||
hideMenuBeforeTyping
|
||||
? {
|
||||
|
||||
Reference in New Issue
Block a user