It works!

This commit is contained in:
Joshua Coles 2023-09-28 10:28:43 +01:00
parent cf08a4ecf0
commit 94664892e4

View File

@ -1,4 +1,4 @@
import {ReactNode} from "react"; import {ReactNode, useCallback} from "react";
import AsyncSelect from "react-select/async"; import AsyncSelect from "react-select/async";
import {FixedSizeList as List} from "react-window"; import {FixedSizeList as List} from "react-window";
import Select, {createFilter, MenuListProps} from "react-select"; import Select, {createFilter, MenuListProps} from "react-select";
@ -69,6 +69,11 @@ const TestSelect = (vendorOptions: any) => {
) )
} }
interface Option {
value: string,
label: string,
}
export function LargeSelect() { export function LargeSelect() {
const { const {
data: options, data: options,
@ -83,13 +88,18 @@ export function LargeSelect() {
return fullData.map(md => ({ return fullData.map(md => ({
value: md.relativePath as string, value: md.relativePath as string,
label: md.fileName as string label: md.fileName as string
})); }) as Option);
}, },
}); });
const onChange = useCallback((value: Option) => {
navigator.clipboard.writeText(`[[${value.label}]]`)
}, []);
return ( return (
<div className={"m-5"}> <div className={"m-5"}>
<Select <Select
onChange={onChange as any}
components={{MenuList}} components={{MenuList}}
isLoading={isLoading} isLoading={isLoading}
options={options} options={options}