final touch

This commit is contained in:
daniel31x13
2024-02-14 08:10:45 -05:00
parent 41df9d0c82
commit 88d73703f8
6 changed files with 70 additions and 15 deletions
+30 -12
View File
@@ -4,6 +4,7 @@ import { useEffect, useState } from "react";
import { styles } from "./styles";
import { Options } from "./types";
import CreatableSelect from "react-select/creatable";
import Select from "react-select";
type Props = {
onChange: any;
@@ -14,12 +15,14 @@ type Props = {
value?: number;
}
| undefined;
creatable?: boolean;
};
export default function CollectionSelection({
onChange,
defaultValue,
showDefaultValue = true,
creatable = true,
}: Props) {
const { collections } = useCollectionStore();
const router = useRouter();
@@ -47,16 +50,31 @@ export default function CollectionSelection({
setOptions(formatedCollections);
}, [collections]);
return (
<CreatableSelect
isClearable={false}
className="react-select-container"
classNamePrefix="react-select"
onChange={onChange}
options={options}
styles={styles}
defaultValue={showDefaultValue ? defaultValue : null}
// menuPosition="fixed"
/>
);
if (creatable) {
return (
<CreatableSelect
isClearable={false}
className="react-select-container"
classNamePrefix="react-select"
onChange={onChange}
options={options}
styles={styles}
defaultValue={showDefaultValue ? defaultValue : null}
// menuPosition="fixed"
/>
);
} else {
return (
<Select
isClearable={false}
className="react-select-container"
classNamePrefix="react-select"
onChange={onChange}
options={options}
styles={styles}
defaultValue={showDefaultValue ? defaultValue : null}
// menuPosition="fixed"
/>
);
}
}