wip
This commit is contained in:
@@ -75,16 +75,17 @@ export const MachineTags = (props: MachineTagsProps) => {
|
||||
sortedAndUniqueOptions([...staticOptions, ...defaultValue]),
|
||||
);
|
||||
|
||||
|
||||
const _setSelectedOptions = (options: MachineTag[] | null) => {
|
||||
console.log("onChange called", options)
|
||||
if (options === null) setSelectedOptions([...staticOptions]);
|
||||
|
||||
setSelectedOptions(
|
||||
sortedOptions(uniqueOptions([...staticOptions, ...(options || [])])),
|
||||
sortedAndUniqueOptions([...staticOptions, ...(options || [])])
|
||||
);
|
||||
};
|
||||
|
||||
const addSelectedOption = (option: MachineTag) => {
|
||||
console.log("Adding option", option)
|
||||
// ensure the new selected option exists in the list of available options
|
||||
setAvailableOptions(sortedAndUniqueOptions([...availableOptions(), option]));
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ const profiles = {
|
||||
lastName: "Burgundy",
|
||||
bio: "It's actually an optical illusion, it's the pattern on the pants.",
|
||||
shareProfile: true,
|
||||
tags: ["All", "Home Server", "Backup", "Random"],
|
||||
tags: ["all", "home Server", "backup", "random"],
|
||||
},
|
||||
};
|
||||
|
||||
@@ -127,8 +127,8 @@ export const Default: Story = {
|
||||
tags: v.pipe(v.array(v.string()), v.nonEmpty()),
|
||||
})}
|
||||
initialValues={profiles.ron}
|
||||
onSubmit={async () => {
|
||||
console.log("saving tags");
|
||||
onSubmit={async (values) => {
|
||||
console.log("saving tags", values);
|
||||
}}
|
||||
>
|
||||
{({ editing, Field }) => (
|
||||
|
||||
Reference in New Issue
Block a user