Skip to content

Commit

Permalink
Fiks feil med at ingenting kan skrives inn
Browse files Browse the repository at this point in the history
  • Loading branch information
joarau committed Oct 31, 2024
1 parent 21fc7e3 commit 1bf6f27
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/stilling/stilling/edit/om-stillingen/janzz/Janzz.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { SET_EMPLOYMENT_JOBTITLE, SET_JANZZ } from '../../../adDataReducer';
import { useDispatch, useSelector } from 'react-redux';
import { State } from '../../../../redux/store';
import { UNSAFE_Combobox as UnsafeCombobox } from '@navikt/ds-react';
import Skjemalabel from '../../skjemaetikett/Skjemalabel';

type Props = {
tittel: string;
Expand Down Expand Up @@ -49,7 +48,13 @@ const Janzz: FunctionComponent<Props> = ({ tittel }) => {
}, [input]);

const onChange = (event: React.ChangeEvent<HTMLInputElement> | null, value?: string) => {
setInput(value || '');
if (event && event.target) {
setInput(event.target.value);
} else if (value !== undefined) {
setInput(value);
} else {
setInput('');
}
};

const onToggleSelected = (option: string, isSelected: boolean, isCustomOption: boolean) => {
Expand Down Expand Up @@ -85,7 +90,7 @@ const Janzz: FunctionComponent<Props> = ({ tittel }) => {
return (
<div>
<UnsafeCombobox
label={<Skjemalabel påkrevd>Yrkestittel som vises på stillingen</Skjemalabel>}
label="Yrkestittel som vises på stillingen"
value={input === 'Stilling uten valgt jobbtittel' ? '' : input}
options={konverterTilComboboxOptions(suggestions)}
onChange={onChange}
Expand Down

0 comments on commit 1bf6f27

Please sign in to comment.