From fa4d58967f4aeabf900041e5e86453cc779cc09f Mon Sep 17 00:00:00 2001 From: JeremiahUy Date: Mon, 23 Oct 2023 14:01:23 +0200 Subject: [PATCH] UPDATE: value update --- .../src/components/admin/CodeList/LovCode.tsx | 25 ++++--------------- .../frontend/src/components/common/Inputs.tsx | 5 ++-- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/apps/frontend/src/components/admin/CodeList/LovCode.tsx b/apps/frontend/src/components/admin/CodeList/LovCode.tsx index 8ae215cf6..a01da634e 100644 --- a/apps/frontend/src/components/admin/CodeList/LovCode.tsx +++ b/apps/frontend/src/components/admin/CodeList/LovCode.tsx @@ -1,28 +1,13 @@ -import { Block, BlockProps } from 'baseui/block' -import { LabelMedium } from 'baseui/typography' +import { Block } from 'baseui/block' import { Field, FieldProps } from 'formik' -import { Code, codelist, CodeListFormValues, ListName, LovCodeData, LovCodeRelevans, lovCodeRelevansToOptions, TemaCodeData } from '../../../services/Codelist' -import { SIZE as InputSIZE } from 'baseui/input' +import { codelist, CodeListFormValues, ListName, LovCodeData, LovCodeRelevans, lovCodeRelevansToOptions, TemaCodeData } from '../../../services/Codelist' import { OptionList } from '../../common/Inputs' import { temaBilder } from '../../Images' -import { StatefulTooltip } from 'baseui/tooltip' -import { faQuestionCircle } from '@fortawesome/free-solid-svg-icons' -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { theme } from '../../../util' import Button from '../../common/Button' -import CustomizedInput from '../../common/CustomizedInput' -import CustomizedSelect from '../../common/CustomizedSelect' -import CustomizedTextarea from '../../common/CustomizedTextarea' import { Error } from '../../common/ModalSchema' import { Label, Select, TextField, Textarea } from '@navikt/ds-react' -const rowBlockProps: BlockProps = { - display: 'flex', - width: '100%', - marginTop: '1rem', - alignItems: 'center', -} - export const LovCodeDataForm = () => { return (
@@ -54,7 +39,7 @@ export const LovCodeDataForm = () => { - set({ lovId: (str.target as HTMLInputElement).value })} className="w-full" label="Lov ID" hideLabel /> + set({ lovId: e.target.value })} className="w-full" label="Lov ID" hideLabel />
@@ -63,7 +48,7 @@ export const LovCodeDataForm = () => { set({ underavdeling: val.code })} label={'underavdeling'} /> @@ -75,7 +60,7 @@ export const LovCodeDataForm = () => { set({ tema: val.code })} label={'tema'} /> diff --git a/apps/frontend/src/components/common/Inputs.tsx b/apps/frontend/src/components/common/Inputs.tsx index f21e81bb7..418f18509 100644 --- a/apps/frontend/src/components/common/Inputs.tsx +++ b/apps/frontend/src/components/common/Inputs.tsx @@ -365,7 +365,7 @@ export const OptionField = ( return ( - {(p: FieldProps) => ( + {(p: FieldProps) => ( } error={p.meta.touched && p.meta.error} caption={props.caption}> p.form.setFieldValue(props.name, val)} value={p.field.value} /> @@ -376,7 +376,7 @@ export const OptionField = ( } export const OptionList = ( - props: { label: string; clearable?: boolean; value?: Code | string; onChange: (val?: any) => void } & Or<{ options: Value }, { listName: ListName }>, + props: { label: string; value?: string; onChange: (val?: any) => void } & Or<{ options: Value }, { listName: ListName }>, ) => { const options: Value = props.options || codelist.getParsedOptions(props.listName) return ( @@ -384,6 +384,7 @@ export const OptionList = ( label={props.label} hideLabel className="w-full" + value={props.value} onChange={(e) => { const val = e.target.value const toSet = props.listName && val ? codelist.getCode(props.listName, val) : val