-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
89 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
# Change Log | ||
|
||
## 4.1.1 | ||
|
||
### Patch Changes | ||
|
||
- oppgavesøk | ||
|
||
## 4.1.0 | ||
|
||
### Minor Changes | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
# Change Log | ||
|
||
## 4.1.1 | ||
|
||
## 4.1.0 | ||
|
||
### Minor Changes | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
# Change Log | ||
|
||
## 4.1.1 | ||
|
||
### Patch Changes | ||
|
||
- oppgavesøk | ||
|
||
## 4.1.0 | ||
|
||
### Minor Changes | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
packages/aap-felles-react/src/KelvinAppHeader/Oppgavesøk.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
'use client' | ||
|
||
import {useState} from "react"; | ||
import {Search} from "@navikt/ds-react"; | ||
import React from "react"; | ||
interface Søkeresultat { | ||
label: string; | ||
href: string; | ||
} | ||
export const Oppgavesøk = () => { | ||
const [søkeResultat, setSøkeresultat] = useState<Søkeresultat[]>([]); | ||
async function utførSøk(søketekst: string) { | ||
const data: Søkeresultat[] = await fetch(`${process.env.NEXT_PUBLIC_OPPGAVESTYRING_URL}/api/oppgave/sok`, { | ||
method: 'POST', | ||
body: JSON.stringify({ søketekst }), | ||
}).then((res) => res.json()); | ||
setSøkeresultat(data); | ||
} | ||
return ( | ||
<form | ||
data-theme={'dark'} | ||
className={'kelvin-oppgavesok-form'} | ||
role={'search'} | ||
onSubmit={(e) => { | ||
const input = e.currentTarget.elements?.[0] as HTMLInputElement; | ||
if (input.value) { | ||
utførSøk(input.value); | ||
} | ||
e.preventDefault(); | ||
}} | ||
> | ||
<Search label={'Søk etter person eller sak'} variant="secondary" hideLabel={true} size={'small'} /> | ||
|
||
{søkeResultat.length !== 0 && ( | ||
<ul className={'kelvin-oppgavesok-resultat'}> | ||
{søkeResultat.map((søk, index) => ( | ||
<li key={`resultat-${index}`}> | ||
<a | ||
href={søk.href} | ||
>{søk.label}</a> | ||
</li> | ||
))} | ||
</ul> | ||
)} | ||
</form> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
# Change Log | ||
|
||
## 4.1.1 | ||
|
||
## 4.1.0 | ||
|
||
### Minor Changes | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
# Change Log | ||
|
||
## 4.1.1 | ||
|
||
## 4.1.0 | ||
|
||
### Minor Changes | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
# Change Log | ||
|
||
## 4.1.1 | ||
|
||
## 4.1.0 | ||
|
||
### Minor Changes | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters