From 44e9ccb26cd6229861f3e2bad1f9880d8b38abf8 Mon Sep 17 00:00:00 2001 From: Markus Johansen Date: Wed, 2 Aug 2023 12:05:08 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Ved=20lagring=20av=20redigering=20l?= =?UTF-8?q?ukkes=20modal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/FeilKort.tsx | 1 + frontend/src/components/FeilmeldingsInnhold.tsx | 11 ++--------- frontend/src/components/RedigeringsVerktoy.tsx | 8 +++----- frontend/src/interface.ts | 6 ++++++ 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/frontend/src/components/FeilKort.tsx b/frontend/src/components/FeilKort.tsx index d54be61..1c9eb27 100644 --- a/frontend/src/components/FeilKort.tsx +++ b/frontend/src/components/FeilKort.tsx @@ -56,6 +56,7 @@ const FeilKort = (props: IFeilKort) => { haster={props.haster} arbeidsstatus={props.arbeidsstatus} setRedigeringsmodus={setRedigeringsmodus} + setVisModal={setVisModal} /> : void - setRedigeringsmodus: (redigeringsmodus: boolean) => void -} - const FeilmeldingsInnhold = (props: FeilmeldingsInnholdInterface) => { return(
@@ -34,7 +27,7 @@ const FeilmeldingsInnhold = (props: FeilmeldingsInnholdInterface) => { onClick={() => { props.setVisModal(false) props.setRedigeringsmodus(false) - }} + } } > Lukk diff --git a/frontend/src/components/RedigeringsVerktoy.tsx b/frontend/src/components/RedigeringsVerktoy.tsx index 45addd9..27d2f0f 100644 --- a/frontend/src/components/RedigeringsVerktoy.tsx +++ b/frontend/src/components/RedigeringsVerktoy.tsx @@ -1,20 +1,18 @@ import { FloppydiskIcon, XMarkIcon } from "@navikt/aksel-icons" import { TextField, Textarea, RadioGroup, Radio, Button } from "@navikt/ds-react" import { useState } from "react" -import { IFeilmelding } from "../interface" +import { FeilmeldingsInnholdInterface } from "../interface" import axios from "axios" -interface RedigeringsInterface extends IFeilmelding { - setRedigeringsmodus: (redigeringsmodus: boolean) => void -} -const RedigeringsVerktoy = (props: RedigeringsInterface) => { +const RedigeringsVerktoy = (props: FeilmeldingsInnholdInterface) => { const [tittel, setTittel] = useState(props.tittel) const [beskrivelse, setBeskrivelse] = useState(props.beskrivelse) const [arbeidsstatus, setArbeidsstatus] = useState(props.arbeidsstatus) const [haster, setHaster] = useState(props.haster) const lagreEndringer = () => { + props.setVisModal(false) props.setRedigeringsmodus(false) const payload = { diff --git a/frontend/src/interface.ts b/frontend/src/interface.ts index 553ca65..a95a0aa 100644 --- a/frontend/src/interface.ts +++ b/frontend/src/interface.ts @@ -12,6 +12,12 @@ export interface IFeilmelding { arbeidsstatus: number } +export interface FeilmeldingsInnholdInterface extends IFeilmelding { + children?: React.ReactNode + setRedigeringsmodus: (redigeringsmodus: boolean) => void + setVisModal: (visModal: boolean) => void +} + export class Feilmelding implements IFeilmelding { id: number = 0 tittel: string = "default tittel"