💄 Gjorde kommentar til en "notat-klistrelapp"
This commit is contained in:
parent
6f6399538e
commit
a8e991420e
2 changed files with 68 additions and 28 deletions
|
@ -1,8 +1,9 @@
|
||||||
import { ChatElipsisIcon, PencilIcon, XMarkIcon } from "@navikt/aksel-icons"
|
import { ChatElipsisIcon, PencilIcon, XMarkIcon } from "@navikt/aksel-icons"
|
||||||
import { Button, Chat, TextField, Textarea } from "@navikt/ds-react"
|
import { Button, Heading, TextField } from "@navikt/ds-react"
|
||||||
import { FeilmeldingsInnholdInterface } from "../interface"
|
import { FeilmeldingsInnholdInterface } from "../interface"
|
||||||
import FeilkortHeader from "./FeilkortHeader"
|
import FeilkortHeader from "./FeilkortHeader"
|
||||||
import { useState } from "react"
|
import { useState } from "react"
|
||||||
|
import Skillelinje from "./Skillelinje"
|
||||||
|
|
||||||
|
|
||||||
const FeilmeldingsInnhold = (props: FeilmeldingsInnholdInterface) => {
|
const FeilmeldingsInnhold = (props: FeilmeldingsInnholdInterface) => {
|
||||||
|
@ -38,40 +39,71 @@ const FeilmeldingsInnhold = (props: FeilmeldingsInnholdInterface) => {
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="h-2 bg-gray-200 my-4 rounded-lg"></div>
|
<Skillelinje/>
|
||||||
{props.children}
|
{props.children}
|
||||||
{kommentar.length === 0 ? <></> : (<Kommentar tekst={kommentar}/>)}
|
{kommentar.length === 0 ?
|
||||||
<div className="flex items-end gap-12 w-full mt-12">
|
<KommentarTekstfelt
|
||||||
<TextField
|
kommentarfelt={kommentarfelt}
|
||||||
className="grow"
|
setKommentarfelt={setKommentarfelt}
|
||||||
label="Skriv inn din kommentar til feilen"
|
setKommentar={setKommentar}
|
||||||
value={kommentarfelt}
|
/>
|
||||||
onChange={e => setKommentarfelt(e.target.value)}
|
:
|
||||||
>
|
<Kommentar
|
||||||
|
tekst={kommentar}
|
||||||
</TextField>
|
setKommentarfelt={setKommentarfelt}
|
||||||
<Button
|
setKommentar={setKommentar}
|
||||||
variant="secondary"
|
/>
|
||||||
icon={<ChatElipsisIcon/>}
|
}
|
||||||
onClick={() => {
|
|
||||||
setKommentar(kommentarfelt)
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Legg til kommentar
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
export default FeilmeldingsInnhold;
|
export default FeilmeldingsInnhold;
|
||||||
|
|
||||||
|
|
||||||
const Kommentar = ({tekst} : {tekst: string}) => {
|
interface Ikommentar {
|
||||||
|
setKommentarfelt: (val: string) => void
|
||||||
|
setKommentar: (val: string) => void
|
||||||
|
}
|
||||||
|
|
||||||
|
interface kommentarTekstfeltInterface extends Ikommentar{
|
||||||
|
kommentarfelt: string,
|
||||||
|
}
|
||||||
|
interface kommentarInterface extends Ikommentar {
|
||||||
|
tekst: string
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const KommentarTekstfelt = (props: kommentarTekstfeltInterface) => {
|
||||||
return(
|
return(
|
||||||
<Chat>
|
<div className="flex items-end gap-12 w-full mt-4 h-fit">
|
||||||
<Chat.Bubble from="user" timestamp="10:00">
|
<TextField
|
||||||
<p>{tekst}</p>
|
className="grow"
|
||||||
</Chat.Bubble>
|
label="Skriv inn din kommentar til feilen"
|
||||||
</Chat>
|
value={props.kommentarfelt}
|
||||||
|
onChange={e => props.setKommentarfelt(e.target.value)}
|
||||||
|
>
|
||||||
|
</TextField>
|
||||||
|
<Button
|
||||||
|
variant="secondary"
|
||||||
|
icon={<ChatElipsisIcon/>}
|
||||||
|
onClick={() => {
|
||||||
|
props.setKommentar(props.kommentarfelt)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Legg til kommentar
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const Kommentar = (props: kommentarInterface) => {
|
||||||
|
return(
|
||||||
|
<>
|
||||||
|
<Skillelinje/>
|
||||||
|
<div className="p-5 bg-bg-subtle rounded-lg w-2/3 my-4">
|
||||||
|
<Heading size="medium">Notat</Heading>
|
||||||
|
<p className="break-words">{props.tekst}</p>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
8
frontend/src/components/Skillelinje.tsx
Normal file
8
frontend/src/components/Skillelinje.tsx
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
|
||||||
|
|
||||||
|
const Skillelinje = () => {
|
||||||
|
return (
|
||||||
|
<div className="h-1 bg-gray-200 my-4 rounded-lg w-full"></div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export default Skillelinje
|
Reference in a new issue