ISSUE-038 - Switched SlotSelector from using strings for onChange() to simply returning the selected index.

As well as just being a little bit better this was necessary to support specifically typed values. We were always going to be selecting between strictly strings. This should allow us to be more flexible.
Also, to avoid a minor bug with switching the Overlay tool with it being invisible SlotSelector now supports being disabled.
This commit is contained in:
Kyle Geib committed 2022-01-28 14:36:50 -05:00
1 parent 8a44d7af65
commit 536d81fb61
4 files changed
+21 -9

No files matched your search

@@ -16,11 +16,11 @@ export function AngledFlagPrototypeControls() {
const dispatch = useDispatch();
const { prototypeState } = useSelector(workspaceSelector);
const onChange = (flag: "flagA" | "flagB") => (value: string) => {
const onChange = (flag: "flagA" | "flagB") => (index: number) => {
dispatch(setPrototypeState({
angledFlag: {
flagA: flag === "flagA" ? value : prototypeState?.angledFlag?.flagA ?? "GBR",
flagB: flag === "flagB" ? value : prototypeState?.angledFlag?.flagB ?? "GBR",
flagA: flag === "flagA" ? countries[index] : prototypeState?.angledFlag?.flagA ?? "GBR",
flagB: flag === "flagB" ? countries[index] : prototypeState?.angledFlag?.flagB ?? "GBR",
},
}));
};