aboutsummaryrefslogtreecommitdiff
path: root/packages/web-util/src/forms/InputChoiceHorizontal.tsx
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2024-05-13 14:47:32 -0300
committerSebastian <sebasjm@gmail.com>2024-05-13 14:47:32 -0300
commitd06accc782a4f2a8f3d84706f026e27fa51bc39a (patch)
treeb0b25a843881e3b249df94346620927be54dfbad /packages/web-util/src/forms/InputChoiceHorizontal.tsx
parente9ba04deb3330208583f371e0bcac869e32e36bc (diff)
downloadwallet-core-d06accc782a4f2a8f3d84706f026e27fa51bc39a.tar.xz
fix some inputs
Diffstat (limited to 'packages/web-util/src/forms/InputChoiceHorizontal.tsx')
-rw-r--r--packages/web-util/src/forms/InputChoiceHorizontal.tsx5
1 files changed, 3 insertions, 2 deletions
diff --git a/packages/web-util/src/forms/InputChoiceHorizontal.tsx b/packages/web-util/src/forms/InputChoiceHorizontal.tsx
index d8361718d..86d3aa926 100644
--- a/packages/web-util/src/forms/InputChoiceHorizontal.tsx
+++ b/packages/web-util/src/forms/InputChoiceHorizontal.tsx
@@ -34,11 +34,12 @@ export function InputChoiceHorizontal<T extends object, K extends keyof T>(
<fieldset class="mt-2">
<div class="isolate inline-flex rounded-md shadow-sm">
{choices.map((choice, idx) => {
+ const convertedValue = converter?.fromStringUI(choice.value as any)
const isFirst = idx === 0;
const isLast = idx === choices.length - 1;
let clazz =
"relative inline-flex items-center px-3 py-2 text-sm font-semibold text-gray-900 ring-1 ring-inset ring-gray-300 focus:z-10";
- if (converter?.fromStringUI(choice.value as any) === value) {
+ if (convertedValue !== undefined && convertedValue === value) {
clazz +=
" text-white bg-indigo-600 hover:bg-indigo-500 ring-2 ring-indigo-600 hover:ring-indigo-500";
} else {
@@ -61,7 +62,7 @@ export function InputChoiceHorizontal<T extends object, K extends keyof T>(
class={clazz}
onClick={(e) => {
onChange(
- (value === choice.value ? undefined : converter?.fromStringUI(choice.value as any)) as any,
+ (value === choice.value ? undefined : convertedValue) as any,
);
}}
>