-
Notifications
You must be signed in to change notification settings - Fork 42
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
5 changed files
with
97 additions
and
20 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@navikt/ds-react": minor | ||
--- | ||
|
||
:sparkles: Modal: Støtte for å lukke ved klikk utenfor |
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
38 changes: 38 additions & 0 deletions
38
aksel.nav.no/website/pages/eksempler/modal/close-on-backdrop-click.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,38 @@ | ||
import { BodyLong, Button, Modal } from "@navikt/ds-react"; | ||
import { withDsExample } from "components/website-modules/examples/withDsExample"; | ||
import { useRef } from "react"; | ||
|
||
const Example = () => { | ||
const ref = useRef<HTMLDialogElement>(null); | ||
|
||
return ( | ||
<div className="py-16"> | ||
<Button onClick={() => ref.current?.showModal()}>Åpne modal</Button> | ||
|
||
<Modal ref={ref} header={{ heading: "Overskrift" }} closeOnBackdropClick> | ||
<Modal.Body> | ||
<BodyLong> | ||
Culpa aliquip ut cupidatat laborum minim quis ex in aliqua. Qui | ||
incididunt dolor do ad ut. Incididunt eiusmod nostrud deserunt duis | ||
laborum. Proident aute culpa qui nostrud velit adipisicing minim. | ||
Consequat aliqua aute dolor do sit Lorem nisi mollit velit. Aliqua | ||
exercitation non minim minim pariatur sunt laborum ipsum. | ||
Exercitation nostrud est laborum magna non non aliqua qui esse. | ||
</BodyLong> | ||
</Modal.Body> | ||
</Modal> | ||
</div> | ||
); | ||
}; | ||
|
||
export default withDsExample(Example); | ||
|
||
/* Storybook story */ | ||
export const Demo = { | ||
render: Example, | ||
}; | ||
|
||
export const args = { | ||
index: 5, | ||
desc: "Husk at det er lett å klikke utenfor ved et uhell. Ikke bruk 'closeOnBackdropClick' hvis det kan føre til at brukeren mister data eller går glipp av viktig informasjon.", | ||
}; |