-
Notifications
You must be signed in to change notification settings - Fork 102
Expand file tree
/
Copy pathSDGFilter.tsx
More file actions
29 lines (27 loc) · 826 Bytes
/
SDGFilter.tsx
File metadata and controls
29 lines (27 loc) · 826 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { useId } from "react";
import Select from "react-select";
type SDGFilterProps = {
setSelectedTopics: (topics: string[]) => void;
topicOptions: { value: string; label: string }[];
};
export const SDGFilter = ({ setSelectedTopics, topicOptions }: SDGFilterProps) => {
const instanceId = useId();
return (
<>
<div>
<label className="label">Sustainable Development Goal (SDG)</label>
<Select
instanceId={instanceId}
isMulti
className=""
options={topicOptions}
getOptionLabel={(option) => option.label}
getOptionValue={(option) => option.value ?? ""}
onChange={(selectedOptions) =>
setSelectedTopics(selectedOptions.map((option) => option.value ?? ""))
}
/>
</div>
</>
);
};