From 89954388b48ccba5e82256e0522877182546fabe Mon Sep 17 00:00:00 2001 From: "Markus A. R. Johansen" <90006516+J0hans1@users.noreply.github.com> Date: Wed, 2 Aug 2023 11:47:28 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Dele=20opp=20feilkort=20(#23)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 🎨 Laget RedigeringsVerktøy komponent * 🎨 Laget Innholdskomponent --- frontend/src/components/FeilKort.tsx | 145 ++++-------------- .../src/components/FeilmeldingsInnhold.tsx | 48 ++++++ .../src/components/RedigeringsVerktoy.tsx | 92 +++++++++++ 3 files changed, 167 insertions(+), 118 deletions(-) create mode 100644 frontend/src/components/FeilmeldingsInnhold.tsx create mode 100644 frontend/src/components/RedigeringsVerktoy.tsx diff --git a/frontend/src/components/FeilKort.tsx b/frontend/src/components/FeilKort.tsx index 7842bf4..d54be61 100644 --- a/frontend/src/components/FeilKort.tsx +++ b/frontend/src/components/FeilKort.tsx @@ -1,11 +1,12 @@ import "@navikt/ds-css"; -import { Button, Modal, Radio, RadioGroup, TextField, Textarea } from "@navikt/ds-react"; -import { IFeilmelding } from "../interface"; +import { Button, Modal} from "@navikt/ds-react"; +import { Feilmelding, IFeilmelding } from "../interface"; import FeilModal from "./FeilModal"; import { useEffect, useState } from "react"; -import { FloppydiskIcon, PencilIcon, XMarkIcon } from "@navikt/aksel-icons"; -import axios from "axios"; +import { PencilIcon, XMarkIcon } from "@navikt/aksel-icons"; import FeilkortHeader from "./FeilkortHeader"; +import RedigeringsVerktoy from "./RedigeringsVerktoy"; +import FeilmeldingsInnhold from "./FeilmeldingsInnhold"; /** * En konteiner som inneholder all informasjon og funksjonalitet for å vise og interagere med en feilmelding. @@ -18,44 +19,14 @@ interface IFeilKort extends IFeilmelding { key: number } - - const FeilKort = (props: IFeilKort) => { +const FeilKort = (props: IFeilKort) => { const [visModal, setVisModal] = useState(false) const [redigeringsmodus, setRedigeringsmodus] = useState(false) - const [tittel, setTittel] = useState(props.tittel) - const [beskrivelse, setBeskrivelse] = useState(props.beskrivelse) - const [arbeidsstatus, setArbeidsstatus] = useState(props.arbeidsstatus) - const [haster, setHaster] = useState(props.haster) useEffect(() => { Modal.setAppElement(document.getElementById('root')); }, []); - const lagreEndringer = () => { - setRedigeringsmodus(false) - - const payload = { - id: props.id, - tittel: tittel, - beskrivelse: beskrivelse, - dato: props.dato.toISOString().replace('Z', ''), - arbeidsstatus: arbeidsstatus, - haster: haster - } - - axios.put(`/api/oppdaterfeil/${props.id}`, payload, { - headers: { - 'Content-Type': 'application/json' - } - }).then((response) => { - console.log(response); - }).catch((error) => { - console.log(error); - }) - - - } - return( <>
{redigeringsmodus ? - -
-
- setTittel(e.target.value)} - /> -