-
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.
Modal: New prop for aligning modal to top (#3033)
- Loading branch information
1 parent
fe93f64
commit 7c644cd
Showing
6 changed files
with
163 additions
and
50 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,6 @@ | ||
--- | ||
"@navikt/ds-react": minor | ||
"@navikt/ds-css": minor | ||
--- | ||
|
||
Modal: New prop `placement` for anchoring the modal to the top of the viewport. |
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
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
34 changes: 34 additions & 0 deletions
34
aksel.nav.no/website/pages/eksempler/modal/placement-top.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,34 @@ | ||
import { useRef } from "react"; | ||
import { BodyLong, Button, Modal } from "@navikt/ds-react"; | ||
import { withDsExample } from "@/web/examples/withDsExample"; | ||
|
||
const Example = () => { | ||
const ref = useRef<HTMLDialogElement>(null); | ||
|
||
return ( | ||
<div className="py-32"> | ||
<Button onClick={() => ref.current?.showModal()}>Åpne modal</Button> | ||
|
||
<Modal ref={ref} header={{ heading: "Overskrift" }} placement="top"> | ||
<Modal.Body> | ||
<BodyLong> | ||
Culpa aliquip ut cupidatat laborum minim quis ex in aliqua. | ||
</BodyLong> | ||
</Modal.Body> | ||
</Modal> | ||
</div> | ||
); | ||
}; | ||
|
||
// EXAMPLES DO NOT INCLUDE CONTENT BELOW THIS LINE | ||
export default withDsExample(Example); | ||
|
||
/* Storybook story */ | ||
export const Demo = { | ||
render: Example, | ||
}; | ||
|
||
export const args = { | ||
index: 6, | ||
desc: "Bruk placement='top' hvis høyden kan endre seg (dynamisk innhold).", | ||
}; |