From 2ae5dc82f024fd9437c9db0af0a20c62b4ef5471 Mon Sep 17 00:00:00 2001 From: WK Wong Date: Sat, 16 Nov 2024 11:46:16 +0800 Subject: [PATCH 1/2] refactor(docs): modal dx --- .../content/components/modal/backdrop.raw.jsx | 75 ++++++ .../docs/content/components/modal/backdrop.ts | 68 +---- .../components/modal/custom-backdrop.raw.jsx | 62 +++++ .../components/modal/custom-backdrop.ts | 55 +--- .../components/modal/custom-motion.raw.jsx | 79 ++++++ .../content/components/modal/custom-motion.ts | 72 +----- .../components/modal/custom-styles.raw.jsx | 70 +++++ .../content/components/modal/custom-styles.ts | 61 +---- .../modal/draggable-overflow.raw.jsx | 48 ++++ .../components/modal/draggable-overflow.ts | 38 +-- .../components/modal/draggable.raw.jsx | 48 ++++ .../content/components/modal/draggable.ts | 38 +-- .../content/components/modal/form.raw.jsx | 112 ++++++++ apps/docs/content/components/modal/form.ts | 110 +------- .../components/modal/non-dismissable.raw.jsx | 60 +++++ .../components/modal/non-dismissable.ts | 48 +--- .../content/components/modal/overflow.raw.jsx | 112 ++++++++ .../content/components/modal/overflow.raw.tsx | 114 ++++++++ .../docs/content/components/modal/overflow.ts | 243 +----------------- .../components/modal/placement.raw.jsx | 114 ++++++++ .../content/components/modal/placement.ts | 59 +---- .../content/components/modal/sizes.raw.jsx | 67 +++++ apps/docs/content/components/modal/sizes.ts | 63 +---- .../content/components/modal/usage.raw.jsx | 55 ++++ apps/docs/content/components/modal/usage.ts | 48 +--- 25 files changed, 1029 insertions(+), 890 deletions(-) create mode 100644 apps/docs/content/components/modal/backdrop.raw.jsx create mode 100644 apps/docs/content/components/modal/custom-backdrop.raw.jsx create mode 100644 apps/docs/content/components/modal/custom-motion.raw.jsx create mode 100644 apps/docs/content/components/modal/custom-styles.raw.jsx create mode 100644 apps/docs/content/components/modal/draggable-overflow.raw.jsx create mode 100644 apps/docs/content/components/modal/draggable.raw.jsx create mode 100644 apps/docs/content/components/modal/form.raw.jsx create mode 100644 apps/docs/content/components/modal/non-dismissable.raw.jsx create mode 100644 apps/docs/content/components/modal/overflow.raw.jsx create mode 100644 apps/docs/content/components/modal/overflow.raw.tsx create mode 100644 apps/docs/content/components/modal/placement.raw.jsx create mode 100644 apps/docs/content/components/modal/sizes.raw.jsx create mode 100644 apps/docs/content/components/modal/usage.raw.jsx diff --git a/apps/docs/content/components/modal/backdrop.raw.jsx b/apps/docs/content/components/modal/backdrop.raw.jsx new file mode 100644 index 0000000000..70beec0096 --- /dev/null +++ b/apps/docs/content/components/modal/backdrop.raw.jsx @@ -0,0 +1,75 @@ +import { + Modal, + ModalContent, + ModalHeader, + ModalBody, + ModalFooter, + Button, + useDisclosure, +} from "@nextui-org/react"; + +export default function App() { + const {isOpen, onOpen, onClose} = useDisclosure(); + const [backdrop, setBackdrop] = React.useState("opaque"); + + const backdrops = ["opaque", "blur", "transparent"]; + + const handleOpen = (backdrop) => { + setBackdrop(backdrop); + onOpen(); + }; + + return ( + <> +
+ {backdrops.map((b) => ( + + ))} +
+ + + {(onClose) => ( + <> + Modal Title + +

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pulvinar risus non + risus hendrerit venenatis. Pellentesque sit amet hendrerit risus, sed porttitor + quam. +

+

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pulvinar risus non + risus hendrerit venenatis. Pellentesque sit amet hendrerit risus, sed porttitor + quam. +

+

+ Magna exercitation reprehenderit magna aute tempor cupidatat consequat elit dolor + adipisicing. Mollit dolor eiusmod sunt ex incididunt cillum quis. Velit duis sit + officia eiusmod Lorem aliqua enim laboris do dolor eiusmod. Et mollit incididunt + nisi consectetur esse laborum eiusmod pariatur proident Lorem eiusmod et. Culpa + deserunt nostrud ad veniam. +

+
+ + + + + + )} +
+
+ + ); +} diff --git a/apps/docs/content/components/modal/backdrop.ts b/apps/docs/content/components/modal/backdrop.ts index b12764e892..53412b0f5b 100644 --- a/apps/docs/content/components/modal/backdrop.ts +++ b/apps/docs/content/components/modal/backdrop.ts @@ -1,70 +1,4 @@ -const App = `import {Modal, ModalContent, ModalHeader, ModalBody, ModalFooter, Button, useDisclosure} from "@nextui-org/react"; - -export default function App() { - const {isOpen, onOpen, onClose} = useDisclosure(); - const [backdrop, setBackdrop] = React.useState('opaque') - - const backdrops = ["opaque", "blur", "transparent"]; - - const handleOpen = (backdrop) => { - setBackdrop(backdrop) - onOpen(); - } - - return ( - <> -
- {backdrops.map((b) => ( - - ))} -
- - - {(onClose) => ( - <> - Modal Title - -

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. - Nullam pulvinar risus non risus hendrerit venenatis. - Pellentesque sit amet hendrerit risus, sed porttitor quam. -

-

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. - Nullam pulvinar risus non risus hendrerit venenatis. - Pellentesque sit amet hendrerit risus, sed porttitor quam. -

-

- Magna exercitation reprehenderit magna aute tempor cupidatat consequat elit - dolor adipisicing. Mollit dolor eiusmod sunt ex incididunt cillum quis. - Velit duis sit officia eiusmod Lorem aliqua enim laboris do dolor eiusmod. - Et mollit incididunt nisi consectetur esse laborum eiusmod pariatur - proident Lorem eiusmod et. Culpa deserunt nostrud ad veniam. -

-
- - - - - - )} -
-
- - ); -}`; +import App from "./backdrop.raw.jsx?raw"; const react = { "/App.jsx": App, diff --git a/apps/docs/content/components/modal/custom-backdrop.raw.jsx b/apps/docs/content/components/modal/custom-backdrop.raw.jsx new file mode 100644 index 0000000000..f4d0d35987 --- /dev/null +++ b/apps/docs/content/components/modal/custom-backdrop.raw.jsx @@ -0,0 +1,62 @@ +import { + Modal, + ModalContent, + ModalHeader, + ModalBody, + ModalFooter, + Button, + useDisclosure, +} from "@nextui-org/react"; + +export default function App() { + const {isOpen, onOpen, onOpenChange} = useDisclosure(); + + return ( + <> + + + + {(onClose) => ( + <> + Modal Title + +

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pulvinar risus non + risus hendrerit venenatis. Pellentesque sit amet hendrerit risus, sed porttitor + quam. +

+

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pulvinar risus non + risus hendrerit venenatis. Pellentesque sit amet hendrerit risus, sed porttitor + quam. +

+

+ Magna exercitation reprehenderit magna aute tempor cupidatat consequat elit dolor + adipisicing. Mollit dolor eiusmod sunt ex incididunt cillum quis. Velit duis sit + officia eiusmod Lorem aliqua enim laboris do dolor eiusmod. Et mollit incididunt + nisi consectetur esse laborum eiusmod pariatur proident Lorem eiusmod et. Culpa + deserunt nostrud ad veniam. +

+
+ + + + + + )} +
+
+ + ); +} diff --git a/apps/docs/content/components/modal/custom-backdrop.ts b/apps/docs/content/components/modal/custom-backdrop.ts index f66cceaaf2..b1364484c4 100644 --- a/apps/docs/content/components/modal/custom-backdrop.ts +++ b/apps/docs/content/components/modal/custom-backdrop.ts @@ -1,57 +1,4 @@ -const App = `import {Modal, ModalContent, ModalHeader, ModalBody, ModalFooter, Button, useDisclosure} from "@nextui-org/react"; - -export default function App() { - const {isOpen, onOpen, onOpenChange} = useDisclosure(); - - return ( - <> - - - - {(onClose) => ( - <> - Modal Title - -

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. - Nullam pulvinar risus non risus hendrerit venenatis. - Pellentesque sit amet hendrerit risus, sed porttitor quam. -

-

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. - Nullam pulvinar risus non risus hendrerit venenatis. - Pellentesque sit amet hendrerit risus, sed porttitor quam. -

-

- Magna exercitation reprehenderit magna aute tempor cupidatat consequat elit - dolor adipisicing. Mollit dolor eiusmod sunt ex incididunt cillum quis. - Velit duis sit officia eiusmod Lorem aliqua enim laboris do dolor eiusmod. - Et mollit incididunt nisi consectetur esse laborum eiusmod pariatur - proident Lorem eiusmod et. Culpa deserunt nostrud ad veniam. -

-
- - - - - - )} -
-
- - ); -}`; +import App from "./custom-backdrop.raw.jsx?raw"; const react = { "/App.jsx": App, diff --git a/apps/docs/content/components/modal/custom-motion.raw.jsx b/apps/docs/content/components/modal/custom-motion.raw.jsx new file mode 100644 index 0000000000..a7ed2dd4a8 --- /dev/null +++ b/apps/docs/content/components/modal/custom-motion.raw.jsx @@ -0,0 +1,79 @@ +import { + Modal, + ModalContent, + ModalHeader, + ModalBody, + ModalFooter, + Button, + useDisclosure, +} from "@nextui-org/react"; + +export default function App() { + const {isOpen, onOpen, onOpenChange} = useDisclosure(); + + return ( + <> + + + + {(onClose) => ( + <> + Modal Title + +

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pulvinar risus non + risus hendrerit venenatis. Pellentesque sit amet hendrerit risus, sed porttitor + quam. +

+

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pulvinar risus non + risus hendrerit venenatis. Pellentesque sit amet hendrerit risus, sed porttitor + quam. +

+

+ Magna exercitation reprehenderit magna aute tempor cupidatat consequat elit dolor + adipisicing. Mollit dolor eiusmod sunt ex incididunt cillum quis. Velit duis sit + officia eiusmod Lorem aliqua enim laboris do dolor eiusmod. Et mollit incididunt + nisi consectetur esse laborum eiusmod pariatur proident Lorem eiusmod et. Culpa + deserunt nostrud ad veniam. +

+
+ + + + + + )} +
+
+ + ); +} diff --git a/apps/docs/content/components/modal/custom-motion.ts b/apps/docs/content/components/modal/custom-motion.ts index e57792729e..389f462ddd 100644 --- a/apps/docs/content/components/modal/custom-motion.ts +++ b/apps/docs/content/components/modal/custom-motion.ts @@ -1,74 +1,4 @@ -const App = `import {Modal, ModalContent, ModalHeader, ModalBody, ModalFooter, Button, useDisclosure} from "@nextui-org/react"; - -export default function App() { - const {isOpen, onOpen, onOpenChange} = useDisclosure(); - - return ( - <> - - - - {(onClose) => ( - <> - Modal Title - -

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. - Nullam pulvinar risus non risus hendrerit venenatis. - Pellentesque sit amet hendrerit risus, sed porttitor quam. -

-

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. - Nullam pulvinar risus non risus hendrerit venenatis. - Pellentesque sit amet hendrerit risus, sed porttitor quam. -

-

- Magna exercitation reprehenderit magna aute tempor cupidatat consequat elit - dolor adipisicing. Mollit dolor eiusmod sunt ex incididunt cillum quis. - Velit duis sit officia eiusmod Lorem aliqua enim laboris do dolor eiusmod. - Et mollit incididunt nisi consectetur esse laborum eiusmod pariatur - proident Lorem eiusmod et. Culpa deserunt nostrud ad veniam. -

-
- - - - - - )} -
-
- - ); -}`; +import App from "./custom-motion.raw.jsx?raw"; const react = { "/App.jsx": App, diff --git a/apps/docs/content/components/modal/custom-styles.raw.jsx b/apps/docs/content/components/modal/custom-styles.raw.jsx new file mode 100644 index 0000000000..d58f5885f4 --- /dev/null +++ b/apps/docs/content/components/modal/custom-styles.raw.jsx @@ -0,0 +1,70 @@ +import { + Modal, + ModalContent, + ModalHeader, + ModalBody, + ModalFooter, + Button, + useDisclosure, +} from "@nextui-org/react"; + +export default function App() { + const {isOpen, onOpen, onOpenChange} = useDisclosure(); + + return ( + <> + + + + {(onClose) => ( + <> + Modal Title + +

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pulvinar risus non + risus hendrerit venenatis. Pellentesque sit amet hendrerit risus, sed porttitor + quam. +

+

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pulvinar risus non + risus hendrerit venenatis. Pellentesque sit amet hendrerit risus, sed porttitor + quam. +

+

+ Magna exercitation reprehenderit magna aute tempor cupidatat consequat elit dolor + adipisicing. Mollit dolor eiusmod sunt ex incididunt cillum quis. Velit duis sit + officia eiusmod Lorem aliqua enim laboris do dolor eiusmod. Et mollit incididunt + nisi consectetur esse laborum eiusmod pariatur proident Lorem eiusmod et. Culpa + deserunt nostrud ad veniam. +

+
+ + + + + + )} +
+
+ + ); +} diff --git a/apps/docs/content/components/modal/custom-styles.ts b/apps/docs/content/components/modal/custom-styles.ts index b2aca285d2..da3ea9093a 100644 --- a/apps/docs/content/components/modal/custom-styles.ts +++ b/apps/docs/content/components/modal/custom-styles.ts @@ -1,63 +1,4 @@ -const App = `import {Modal, ModalContent, ModalHeader, ModalBody, ModalFooter, Button, useDisclosure} from "@nextui-org/react"; - -export default function App() { - const {isOpen, onOpen, onOpenChange} = useDisclosure(); - - return ( - <> - - - - {(onClose) => ( - <> - Modal Title - -

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. - Nullam pulvinar risus non risus hendrerit venenatis. - Pellentesque sit amet hendrerit risus, sed porttitor quam. -

-

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. - Nullam pulvinar risus non risus hendrerit venenatis. - Pellentesque sit amet hendrerit risus, sed porttitor quam. -

-

- Magna exercitation reprehenderit magna aute tempor cupidatat consequat elit - dolor adipisicing. Mollit dolor eiusmod sunt ex incididunt cillum quis. - Velit duis sit officia eiusmod Lorem aliqua enim laboris do dolor eiusmod. - Et mollit incididunt nisi consectetur esse laborum eiusmod pariatur - proident Lorem eiusmod et. Culpa deserunt nostrud ad veniam. -

-
- - - - - - )} -
-
- - ); -}`; +import App from "./custom-styles.raw.jsx?raw"; const react = { "/App.jsx": App, diff --git a/apps/docs/content/components/modal/draggable-overflow.raw.jsx b/apps/docs/content/components/modal/draggable-overflow.raw.jsx new file mode 100644 index 0000000000..dc428323b0 --- /dev/null +++ b/apps/docs/content/components/modal/draggable-overflow.raw.jsx @@ -0,0 +1,48 @@ +import { + Modal, + ModalContent, + ModalHeader, + ModalBody, + ModalFooter, + Button, + useDisclosure, + useDraggable, +} from "@nextui-org/react"; + +export default function App() { + const {isOpen, onOpen, onOpenChange} = useDisclosure(); + const targetRef = React.useRef(null); + const {moveProps} = useDraggable({targetRef, canOverflow: true}); + + return ( + <> + + + + {(onClose) => ( + <> + + Modal Title + + +

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pulvinar risus non + risus hendrerit venenatis. Pellentesque sit amet hendrerit risus, sed porttitor + quam. +

+
+ + + + + + )} +
+
+ + ); +} diff --git a/apps/docs/content/components/modal/draggable-overflow.ts b/apps/docs/content/components/modal/draggable-overflow.ts index da7a442fda..86fe16fec6 100644 --- a/apps/docs/content/components/modal/draggable-overflow.ts +++ b/apps/docs/content/components/modal/draggable-overflow.ts @@ -1,40 +1,4 @@ -const App = `import {Modal, ModalContent, ModalHeader, ModalBody, ModalFooter, Button, useDisclosure, useDraggable} from "@nextui-org/react"; - -export default function App() { - const {isOpen, onOpen, onOpenChange} = useDisclosure(); - const targetRef = React.useRef(null); - const {moveProps} = useDraggable({targetRef, canOverflow: true}); - - return ( - <> - - - - {(onClose) => ( - <> - Modal Title - -

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. - Nullam pulvinar risus non risus hendrerit venenatis. - Pellentesque sit amet hendrerit risus, sed porttitor quam. -

-
- - - - - - )} -
-
- - ); -}`; +import App from "./draggable-overflow.raw.jsx?raw"; const react = { "/App.jsx": App, diff --git a/apps/docs/content/components/modal/draggable.raw.jsx b/apps/docs/content/components/modal/draggable.raw.jsx new file mode 100644 index 0000000000..4cd170dfef --- /dev/null +++ b/apps/docs/content/components/modal/draggable.raw.jsx @@ -0,0 +1,48 @@ +import { + Modal, + ModalContent, + ModalHeader, + ModalBody, + ModalFooter, + Button, + useDisclosure, + useDraggable, +} from "@nextui-org/react"; + +export default function App() { + const {isOpen, onOpen, onOpenChange} = useDisclosure(); + const targetRef = React.useRef(null); + const {moveProps} = useDraggable({targetRef}); + + return ( + <> + + + + {(onClose) => ( + <> + + Modal Title + + +

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pulvinar risus non + risus hendrerit venenatis. Pellentesque sit amet hendrerit risus, sed porttitor + quam. +

+
+ + + + + + )} +
+
+ + ); +} diff --git a/apps/docs/content/components/modal/draggable.ts b/apps/docs/content/components/modal/draggable.ts index a2dada19a7..276b37d2be 100644 --- a/apps/docs/content/components/modal/draggable.ts +++ b/apps/docs/content/components/modal/draggable.ts @@ -1,40 +1,4 @@ -const App = `import {Modal, ModalContent, ModalHeader, ModalBody, ModalFooter, Button, useDisclosure, useDraggable} from "@nextui-org/react"; - -export default function App() { - const {isOpen, onOpen, onOpenChange} = useDisclosure(); - const targetRef = React.useRef(null); - const {moveProps} = useDraggable({ targetRef }); - - return ( - <> - - - - {(onClose) => ( - <> - Modal Title - -

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. - Nullam pulvinar risus non risus hendrerit venenatis. - Pellentesque sit amet hendrerit risus, sed porttitor quam. -

-
- - - - - - )} -
-
- - ); -}`; +import App from "./draggable.raw.jsx?raw"; const react = { "/App.jsx": App, diff --git a/apps/docs/content/components/modal/form.raw.jsx b/apps/docs/content/components/modal/form.raw.jsx new file mode 100644 index 0000000000..0cdad526ab --- /dev/null +++ b/apps/docs/content/components/modal/form.raw.jsx @@ -0,0 +1,112 @@ +import { + Modal, + ModalContent, + ModalHeader, + ModalBody, + ModalFooter, + Button, + useDisclosure, + Checkbox, + Input, + Link, +} from "@nextui-org/react"; + +export const MailIcon = (props) => ( + +); + +export const LockIcon = (props) => ( + +); + +export default function App() { + const {isOpen, onOpen, onOpenChange} = useDisclosure(); + + return ( + <> + + + + {(onClose) => ( + <> + Log in + + + } + label="Email" + placeholder="Enter your email" + variant="bordered" + /> + + } + label="Password" + placeholder="Enter your password" + type="password" + variant="bordered" + /> +
+ + Remember me + + + Forgot password? + +
+
+ + + + + + )} +
+
+ + ); +} diff --git a/apps/docs/content/components/modal/form.ts b/apps/docs/content/components/modal/form.ts index 576d5657e2..c9bad48bd2 100644 --- a/apps/docs/content/components/modal/form.ts +++ b/apps/docs/content/components/modal/form.ts @@ -1,115 +1,7 @@ -const MailIcon = `export const MailIcon = (props) => ( - -); -`; - -const LockIcon = `export const LockIcon = (props) => ( - -);`; - -const App = `import {Modal, ModalContent, ModalHeader, ModalBody, ModalFooter, Button, useDisclosure, Checkbox, Input, Link} from "@nextui-org/react"; -import {MailIcon} from './MailIcon.jsx'; -import {LockIcon} from './LockIcon.jsx'; - -export default function App() { - const {isOpen, onOpen, onOpenChange} = useDisclosure(); - - return ( - <> - - - - {(onClose) => ( - <> - Log in - - - } - label="Email" - placeholder="Enter your email" - variant="bordered" - /> - - } - label="Password" - placeholder="Enter your password" - type="password" - variant="bordered" - /> -
- - Remember me - - - Forgot password? - -
-
- - - - - - )} -
-
- - ); -}`; +import App from "./form.raw.jsx?raw"; const react = { "/App.jsx": App, - "/MailIcon.jsx": MailIcon, - "/LockIcon.jsx": LockIcon, }; export default { diff --git a/apps/docs/content/components/modal/non-dismissable.raw.jsx b/apps/docs/content/components/modal/non-dismissable.raw.jsx new file mode 100644 index 0000000000..64d29b31da --- /dev/null +++ b/apps/docs/content/components/modal/non-dismissable.raw.jsx @@ -0,0 +1,60 @@ +import { + Modal, + ModalContent, + ModalHeader, + ModalBody, + ModalFooter, + Button, + useDisclosure, +} from "@nextui-org/react"; + +export default function App() { + const {isOpen, onOpen, onOpenChange} = useDisclosure(); + + return ( + <> + + + + {(onClose) => ( + <> + Modal Title + +

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pulvinar risus non + risus hendrerit venenatis. Pellentesque sit amet hendrerit risus, sed porttitor + quam. +

+

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pulvinar risus non + risus hendrerit venenatis. Pellentesque sit amet hendrerit risus, sed porttitor + quam. +

+

+ Magna exercitation reprehenderit magna aute tempor cupidatat consequat elit dolor + adipisicing. Mollit dolor eiusmod sunt ex incididunt cillum quis. Velit duis sit + officia eiusmod Lorem aliqua enim laboris do dolor eiusmod. Et mollit incididunt + nisi consectetur esse laborum eiusmod pariatur proident Lorem eiusmod et. Culpa + deserunt nostrud ad veniam. +

+
+ + + + + + )} +
+
+ + ); +} diff --git a/apps/docs/content/components/modal/non-dismissable.ts b/apps/docs/content/components/modal/non-dismissable.ts index 5e84335ca8..a1281cb23a 100644 --- a/apps/docs/content/components/modal/non-dismissable.ts +++ b/apps/docs/content/components/modal/non-dismissable.ts @@ -1,50 +1,4 @@ -const App = `import {Modal, ModalContent, ModalHeader, ModalBody, ModalFooter, Button, useDisclosure} from "@nextui-org/react"; - -export default function App() { - const {isOpen, onOpen, onOpenChange} = useDisclosure(); - - return ( - <> - - - - {(onClose) => ( - <> - Modal Title - -

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. - Nullam pulvinar risus non risus hendrerit venenatis. - Pellentesque sit amet hendrerit risus, sed porttitor quam. -

-

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. - Nullam pulvinar risus non risus hendrerit venenatis. - Pellentesque sit amet hendrerit risus, sed porttitor quam. -

-

- Magna exercitation reprehenderit magna aute tempor cupidatat consequat elit - dolor adipisicing. Mollit dolor eiusmod sunt ex incididunt cillum quis. - Velit duis sit officia eiusmod Lorem aliqua enim laboris do dolor eiusmod. - Et mollit incididunt nisi consectetur esse laborum eiusmod pariatur - proident Lorem eiusmod et. Culpa deserunt nostrud ad veniam. -

-
- - - - - - )} -
-
- - ); -}`; +import App from "./non-dismissable.raw.jsx?raw"; const react = { "/App.jsx": App, diff --git a/apps/docs/content/components/modal/overflow.raw.jsx b/apps/docs/content/components/modal/overflow.raw.jsx new file mode 100644 index 0000000000..69ff91e9c1 --- /dev/null +++ b/apps/docs/content/components/modal/overflow.raw.jsx @@ -0,0 +1,112 @@ +import { + Modal, + ModalContent, + ModalHeader, + ModalBody, + ModalFooter, + Button, + useDisclosure, + RadioGroup, + Radio, +} from "@nextui-org/react"; + +export default function App() { + const {isOpen, onOpen, onOpenChange} = useDisclosure(); + const [scrollBehavior, setScrollBehavior] = React.useState("inside"); + + return ( +
+ + + inside + outside + + + + {(onClose) => ( + <> + Modal Title + +

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pulvinar risus non + risus hendrerit venenatis. Pellentesque sit amet hendrerit risus, sed porttitor + quam. +

+

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pulvinar risus non + risus hendrerit venenatis. Pellentesque sit amet hendrerit risus, sed porttitor + quam. +

+

+ Magna exercitation reprehenderit magna aute tempor cupidatat consequat elit dolor + adipisicing. Mollit dolor eiusmod sunt ex incididunt cillum quis. Velit duis sit + officia eiusmod Lorem aliqua enim laboris do dolor eiusmod. Et mollit incididunt + nisi consectetur esse laborum eiusmod pariatur proident Lorem eiusmod et. Culpa + deserunt nostrud ad veniam. +

+

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pulvinar risus non + risus hendrerit venenatis. Pellentesque sit amet hendrerit risus, sed porttitor + quam. Magna exercitation reprehenderit magna aute tempor cupidatat consequat elit + dolor adipisicing. Mollit dolor eiusmod sunt ex incididunt cillum quis. Velit duis + sit officia eiusmod Lorem aliqua enim laboris do dolor eiusmod. Et mollit + incididunt nisi consectetur esse laborum eiusmod pariatur proident Lorem eiusmod + et. Culpa deserunt nostrud ad veniam. +

+

+ Mollit dolor eiusmod sunt ex incididunt cillum quis. Velit duis sit officia + eiusmod Lorem aliqua enim laboris do dolor eiusmod. Et mollit incididunt nisi + consectetur esse laborum eiusmod pariatur proident Lorem eiusmod et. Culpa + deserunt nostrud ad veniam. Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Nullam pulvinar risus non risus hendrerit venenatis. Pellentesque sit amet + hendrerit risus, sed porttitor quam. Magna exercitation reprehenderit magna aute + tempor cupidatat consequat elit dolor adipisicing. Mollit dolor eiusmod sunt ex + incididunt cillum quis. Velit duis sit officia eiusmod Lorem aliqua enim laboris + do dolor eiusmod. Et mollit incididunt nisi consectetur esse laborum eiusmod + pariatur proident Lorem eiusmod et. Culpa deserunt nostrud ad veniam. +

+

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pulvinar risus non + risus hendrerit venenatis. Pellentesque sit amet hendrerit risus, sed porttitor + quam. +

+

+ Magna exercitation reprehenderit magna aute tempor cupidatat consequat elit dolor + adipisicing. Mollit dolor eiusmod sunt ex incididunt cillum quis. Velit duis sit + officia eiusmod Lorem aliqua enim laboris do dolor eiusmod. Et mollit incididunt + nisi consectetur esse laborum eiusmod pariatur proident Lorem eiusmod et. Culpa + deserunt nostrud ad veniam. +

+

+ Mollit dolor eiusmod sunt ex incididunt cillum quis. Velit duis sit officia + eiusmod Lorem aliqua enim laboris do dolor eiusmod. Et mollit incididunt nisi + consectetur esse laborum eiusmod pariatur proident Lorem eiusmod et. Culpa + deserunt nostrud ad veniam. Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Nullam pulvinar risus non risus hendrerit venenatis. Pellentesque sit amet + hendrerit risus, sed porttitor quam. Magna exercitation reprehenderit magna aute + tempor cupidatat consequat elit dolor adipisicing. Mollit dolor eiusmod sunt ex + incididunt cillum quis. Velit duis sit officia eiusmod Lorem aliqua enim laboris + do dolor eiusmod. Et mollit incididunt nisi consectetur esse laborum eiusmod + pariatur proident Lorem eiusmod et. Culpa deserunt nostrud ad veniam. +

+
+ + + + + + )} +
+
+
+ ); +} diff --git a/apps/docs/content/components/modal/overflow.raw.tsx b/apps/docs/content/components/modal/overflow.raw.tsx new file mode 100644 index 0000000000..a3ff752be8 --- /dev/null +++ b/apps/docs/content/components/modal/overflow.raw.tsx @@ -0,0 +1,114 @@ +import { + Modal, + ModalContent, + ModalHeader, + ModalBody, + ModalFooter, + ModalProps, + Button, + useDisclosure, + RadioGroup, + Radio, +} from "@nextui-org/react"; + +export default function App() { + const {isOpen, onOpen, onOpenChange} = useDisclosure(); + const [scrollBehavior, setScrollBehavior] = + React.useState < ModalProps["scrollBehavior"] > "inside"; + + return ( +
+ + + inside + outside + + + + {(onClose) => ( + <> + Modal Title + +

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pulvinar risus non + risus hendrerit venenatis. Pellentesque sit amet hendrerit risus, sed porttitor + quam. +

+

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pulvinar risus non + risus hendrerit venenatis. Pellentesque sit amet hendrerit risus, sed porttitor + quam. +

+

+ Magna exercitation reprehenderit magna aute tempor cupidatat consequat elit dolor + adipisicing. Mollit dolor eiusmod sunt ex incididunt cillum quis. Velit duis sit + officia eiusmod Lorem aliqua enim laboris do dolor eiusmod. Et mollit incididunt + nisi consectetur esse laborum eiusmod pariatur proident Lorem eiusmod et. Culpa + deserunt nostrud ad veniam. +

+

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pulvinar risus non + risus hendrerit venenatis. Pellentesque sit amet hendrerit risus, sed porttitor + quam. Magna exercitation reprehenderit magna aute tempor cupidatat consequat elit + dolor adipisicing. Mollit dolor eiusmod sunt ex incididunt cillum quis. Velit duis + sit officia eiusmod Lorem aliqua enim laboris do dolor eiusmod. Et mollit + incididunt nisi consectetur esse laborum eiusmod pariatur proident Lorem eiusmod + et. Culpa deserunt nostrud ad veniam. +

+

+ Mollit dolor eiusmod sunt ex incididunt cillum quis. Velit duis sit officia + eiusmod Lorem aliqua enim laboris do dolor eiusmod. Et mollit incididunt nisi + consectetur esse laborum eiusmod pariatur proident Lorem eiusmod et. Culpa + deserunt nostrud ad veniam. Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Nullam pulvinar risus non risus hendrerit venenatis. Pellentesque sit amet + hendrerit risus, sed porttitor quam. Magna exercitation reprehenderit magna aute + tempor cupidatat consequat elit dolor adipisicing. Mollit dolor eiusmod sunt ex + incididunt cillum quis. Velit duis sit officia eiusmod Lorem aliqua enim laboris + do dolor eiusmod. Et mollit incididunt nisi consectetur esse laborum eiusmod + pariatur proident Lorem eiusmod et. Culpa deserunt nostrud ad veniam. +

+

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pulvinar risus non + risus hendrerit venenatis. Pellentesque sit amet hendrerit risus, sed porttitor + quam. +

+

+ Magna exercitation reprehenderit magna aute tempor cupidatat consequat elit dolor + adipisicing. Mollit dolor eiusmod sunt ex incididunt cillum quis. Velit duis sit + officia eiusmod Lorem aliqua enim laboris do dolor eiusmod. Et mollit incididunt + nisi consectetur esse laborum eiusmod pariatur proident Lorem eiusmod et. Culpa + deserunt nostrud ad veniam. +

+

+ Mollit dolor eiusmod sunt ex incididunt cillum quis. Velit duis sit officia + eiusmod Lorem aliqua enim laboris do dolor eiusmod. Et mollit incididunt nisi + consectetur esse laborum eiusmod pariatur proident Lorem eiusmod et. Culpa + deserunt nostrud ad veniam. Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Nullam pulvinar risus non risus hendrerit venenatis. Pellentesque sit amet + hendrerit risus, sed porttitor quam. Magna exercitation reprehenderit magna aute + tempor cupidatat consequat elit dolor adipisicing. Mollit dolor eiusmod sunt ex + incididunt cillum quis. Velit duis sit officia eiusmod Lorem aliqua enim laboris + do dolor eiusmod. Et mollit incididunt nisi consectetur esse laborum eiusmod + pariatur proident Lorem eiusmod et. Culpa deserunt nostrud ad veniam. +

+
+ + + + + + )} +
+
+
+ ); +} diff --git a/apps/docs/content/components/modal/overflow.ts b/apps/docs/content/components/modal/overflow.ts index d9d3ba869f..5276c45e73 100644 --- a/apps/docs/content/components/modal/overflow.ts +++ b/apps/docs/content/components/modal/overflow.ts @@ -1,244 +1,5 @@ -const App = `import {Modal, ModalContent, ModalHeader, ModalBody, ModalFooter, Button, useDisclosure, RadioGroup, Radio} from "@nextui-org/react"; - -export default function App() { - const {isOpen, onOpen, onOpenChange} = useDisclosure(); - const [scrollBehavior, setScrollBehavior] = React.useState("inside"); - - return ( -
- - - inside - outside - - - - {(onClose) => ( - <> - - Modal Title - - -

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. - Nullam pulvinar risus non risus hendrerit venenatis. - Pellentesque sit amet hendrerit risus, sed porttitor quam. -

-

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. - Nullam pulvinar risus non risus hendrerit venenatis. - Pellentesque sit amet hendrerit risus, sed porttitor quam. -

-

- Magna exercitation reprehenderit magna aute tempor cupidatat - consequat elit dolor adipisicing. Mollit dolor eiusmod sunt ex - incididunt cillum quis. Velit duis sit officia eiusmod Lorem - aliqua enim laboris do dolor eiusmod. Et mollit incididunt - nisi consectetur esse laborum eiusmod pariatur proident Lorem - eiusmod et. Culpa deserunt nostrud ad veniam. -

-

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. - Nullam pulvinar risus non risus hendrerit venenatis. - Pellentesque sit amet hendrerit risus, sed porttitor quam. - Magna exercitation reprehenderit magna aute tempor cupidatat - consequat elit dolor adipisicing. Mollit dolor eiusmod sunt ex - incididunt cillum quis. Velit duis sit officia eiusmod Lorem - aliqua enim laboris do dolor eiusmod. Et mollit incididunt - nisi consectetur esse laborum eiusmod pariatur proident Lorem - eiusmod et. Culpa deserunt nostrud ad veniam. -

-

- Mollit dolor eiusmod sunt ex incididunt cillum quis. Velit - duis sit officia eiusmod Lorem aliqua enim laboris do dolor - eiusmod. Et mollit incididunt nisi consectetur esse laborum - eiusmod pariatur proident Lorem eiusmod et. Culpa deserunt - nostrud ad veniam. Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Nullam pulvinar risus non risus hendrerit - venenatis. Pellentesque sit amet hendrerit risus, sed - porttitor quam. Magna exercitation reprehenderit magna aute - tempor cupidatat consequat elit dolor adipisicing. Mollit - dolor eiusmod sunt ex incididunt cillum quis. Velit duis sit - officia eiusmod Lorem aliqua enim laboris do dolor eiusmod. Et - mollit incididunt nisi consectetur esse laborum eiusmod - pariatur proident Lorem eiusmod et. Culpa deserunt nostrud ad - veniam. -

-

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. - Nullam pulvinar risus non risus hendrerit venenatis. - Pellentesque sit amet hendrerit risus, sed porttitor quam. -

-

- Magna exercitation reprehenderit magna aute tempor cupidatat - consequat elit dolor adipisicing. Mollit dolor eiusmod sunt ex - incididunt cillum quis. Velit duis sit officia eiusmod Lorem - aliqua enim laboris do dolor eiusmod. Et mollit incididunt - nisi consectetur esse laborum eiusmod pariatur proident Lorem - eiusmod et. Culpa deserunt nostrud ad veniam. -

-

- Mollit dolor eiusmod sunt ex incididunt cillum quis. Velit - duis sit officia eiusmod Lorem aliqua enim laboris do dolor - eiusmod. Et mollit incididunt nisi consectetur esse laborum - eiusmod pariatur proident Lorem eiusmod et. Culpa deserunt - nostrud ad veniam. Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Nullam pulvinar risus non risus hendrerit - venenatis. Pellentesque sit amet hendrerit risus, sed - porttitor quam. Magna exercitation reprehenderit magna aute - tempor cupidatat consequat elit dolor adipisicing. Mollit - dolor eiusmod sunt ex incididunt cillum quis. Velit duis sit - officia eiusmod Lorem aliqua enim laboris do dolor eiusmod. Et - mollit incididunt nisi consectetur esse laborum eiusmod - pariatur proident Lorem eiusmod et. Culpa deserunt nostrud ad - veniam. -

-
- - - - - - )} -
-
-
- ); -}`; - -const AppTs = `import {Modal, ModalContent, ModalHeader, ModalBody, ModalFooter, ModalProps, Button, useDisclosure, RadioGroup, Radio} from "@nextui-org/react"; - -export default function App() { - const {isOpen, onOpen, onOpenChange} = useDisclosure(); - const [scrollBehavior, setScrollBehavior] = React.useState("inside"); - - return ( -
- - - inside - outside - - - - {(onClose) => ( - <> - - Modal Title - - -

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. - Nullam pulvinar risus non risus hendrerit venenatis. - Pellentesque sit amet hendrerit risus, sed porttitor quam. -

-

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. - Nullam pulvinar risus non risus hendrerit venenatis. - Pellentesque sit amet hendrerit risus, sed porttitor quam. -

-

- Magna exercitation reprehenderit magna aute tempor cupidatat - consequat elit dolor adipisicing. Mollit dolor eiusmod sunt ex - incididunt cillum quis. Velit duis sit officia eiusmod Lorem - aliqua enim laboris do dolor eiusmod. Et mollit incididunt - nisi consectetur esse laborum eiusmod pariatur proident Lorem - eiusmod et. Culpa deserunt nostrud ad veniam. -

-

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. - Nullam pulvinar risus non risus hendrerit venenatis. - Pellentesque sit amet hendrerit risus, sed porttitor quam. - Magna exercitation reprehenderit magna aute tempor cupidatat - consequat elit dolor adipisicing. Mollit dolor eiusmod sunt ex - incididunt cillum quis. Velit duis sit officia eiusmod Lorem - aliqua enim laboris do dolor eiusmod. Et mollit incididunt - nisi consectetur esse laborum eiusmod pariatur proident Lorem - eiusmod et. Culpa deserunt nostrud ad veniam. -

-

- Mollit dolor eiusmod sunt ex incididunt cillum quis. Velit - duis sit officia eiusmod Lorem aliqua enim laboris do dolor - eiusmod. Et mollit incididunt nisi consectetur esse laborum - eiusmod pariatur proident Lorem eiusmod et. Culpa deserunt - nostrud ad veniam. Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Nullam pulvinar risus non risus hendrerit - venenatis. Pellentesque sit amet hendrerit risus, sed - porttitor quam. Magna exercitation reprehenderit magna aute - tempor cupidatat consequat elit dolor adipisicing. Mollit - dolor eiusmod sunt ex incididunt cillum quis. Velit duis sit - officia eiusmod Lorem aliqua enim laboris do dolor eiusmod. Et - mollit incididunt nisi consectetur esse laborum eiusmod - pariatur proident Lorem eiusmod et. Culpa deserunt nostrud ad - veniam. -

-

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. - Nullam pulvinar risus non risus hendrerit venenatis. - Pellentesque sit amet hendrerit risus, sed porttitor quam. -

-

- Magna exercitation reprehenderit magna aute tempor cupidatat - consequat elit dolor adipisicing. Mollit dolor eiusmod sunt ex - incididunt cillum quis. Velit duis sit officia eiusmod Lorem - aliqua enim laboris do dolor eiusmod. Et mollit incididunt - nisi consectetur esse laborum eiusmod pariatur proident Lorem - eiusmod et. Culpa deserunt nostrud ad veniam. -

-

- Mollit dolor eiusmod sunt ex incididunt cillum quis. Velit - duis sit officia eiusmod Lorem aliqua enim laboris do dolor - eiusmod. Et mollit incididunt nisi consectetur esse laborum - eiusmod pariatur proident Lorem eiusmod et. Culpa deserunt - nostrud ad veniam. Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Nullam pulvinar risus non risus hendrerit - venenatis. Pellentesque sit amet hendrerit risus, sed - porttitor quam. Magna exercitation reprehenderit magna aute - tempor cupidatat consequat elit dolor adipisicing. Mollit - dolor eiusmod sunt ex incididunt cillum quis. Velit duis sit - officia eiusmod Lorem aliqua enim laboris do dolor eiusmod. Et - mollit incididunt nisi consectetur esse laborum eiusmod - pariatur proident Lorem eiusmod et. Culpa deserunt nostrud ad - veniam. -

-
- - - - - - )} -
-
-
- ); -}`; +import App from "./overflow.raw.jsx?raw"; +import AppTs from "./overflow.raw.tsx?raw"; const react = { "/App.jsx": App, diff --git a/apps/docs/content/components/modal/placement.raw.jsx b/apps/docs/content/components/modal/placement.raw.jsx new file mode 100644 index 0000000000..a3ff752be8 --- /dev/null +++ b/apps/docs/content/components/modal/placement.raw.jsx @@ -0,0 +1,114 @@ +import { + Modal, + ModalContent, + ModalHeader, + ModalBody, + ModalFooter, + ModalProps, + Button, + useDisclosure, + RadioGroup, + Radio, +} from "@nextui-org/react"; + +export default function App() { + const {isOpen, onOpen, onOpenChange} = useDisclosure(); + const [scrollBehavior, setScrollBehavior] = + React.useState < ModalProps["scrollBehavior"] > "inside"; + + return ( +
+ + + inside + outside + + + + {(onClose) => ( + <> + Modal Title + +

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pulvinar risus non + risus hendrerit venenatis. Pellentesque sit amet hendrerit risus, sed porttitor + quam. +

+

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pulvinar risus non + risus hendrerit venenatis. Pellentesque sit amet hendrerit risus, sed porttitor + quam. +

+

+ Magna exercitation reprehenderit magna aute tempor cupidatat consequat elit dolor + adipisicing. Mollit dolor eiusmod sunt ex incididunt cillum quis. Velit duis sit + officia eiusmod Lorem aliqua enim laboris do dolor eiusmod. Et mollit incididunt + nisi consectetur esse laborum eiusmod pariatur proident Lorem eiusmod et. Culpa + deserunt nostrud ad veniam. +

+

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pulvinar risus non + risus hendrerit venenatis. Pellentesque sit amet hendrerit risus, sed porttitor + quam. Magna exercitation reprehenderit magna aute tempor cupidatat consequat elit + dolor adipisicing. Mollit dolor eiusmod sunt ex incididunt cillum quis. Velit duis + sit officia eiusmod Lorem aliqua enim laboris do dolor eiusmod. Et mollit + incididunt nisi consectetur esse laborum eiusmod pariatur proident Lorem eiusmod + et. Culpa deserunt nostrud ad veniam. +

+

+ Mollit dolor eiusmod sunt ex incididunt cillum quis. Velit duis sit officia + eiusmod Lorem aliqua enim laboris do dolor eiusmod. Et mollit incididunt nisi + consectetur esse laborum eiusmod pariatur proident Lorem eiusmod et. Culpa + deserunt nostrud ad veniam. Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Nullam pulvinar risus non risus hendrerit venenatis. Pellentesque sit amet + hendrerit risus, sed porttitor quam. Magna exercitation reprehenderit magna aute + tempor cupidatat consequat elit dolor adipisicing. Mollit dolor eiusmod sunt ex + incididunt cillum quis. Velit duis sit officia eiusmod Lorem aliqua enim laboris + do dolor eiusmod. Et mollit incididunt nisi consectetur esse laborum eiusmod + pariatur proident Lorem eiusmod et. Culpa deserunt nostrud ad veniam. +

+

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pulvinar risus non + risus hendrerit venenatis. Pellentesque sit amet hendrerit risus, sed porttitor + quam. +

+

+ Magna exercitation reprehenderit magna aute tempor cupidatat consequat elit dolor + adipisicing. Mollit dolor eiusmod sunt ex incididunt cillum quis. Velit duis sit + officia eiusmod Lorem aliqua enim laboris do dolor eiusmod. Et mollit incididunt + nisi consectetur esse laborum eiusmod pariatur proident Lorem eiusmod et. Culpa + deserunt nostrud ad veniam. +

+

+ Mollit dolor eiusmod sunt ex incididunt cillum quis. Velit duis sit officia + eiusmod Lorem aliqua enim laboris do dolor eiusmod. Et mollit incididunt nisi + consectetur esse laborum eiusmod pariatur proident Lorem eiusmod et. Culpa + deserunt nostrud ad veniam. Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Nullam pulvinar risus non risus hendrerit venenatis. Pellentesque sit amet + hendrerit risus, sed porttitor quam. Magna exercitation reprehenderit magna aute + tempor cupidatat consequat elit dolor adipisicing. Mollit dolor eiusmod sunt ex + incididunt cillum quis. Velit duis sit officia eiusmod Lorem aliqua enim laboris + do dolor eiusmod. Et mollit incididunt nisi consectetur esse laborum eiusmod + pariatur proident Lorem eiusmod et. Culpa deserunt nostrud ad veniam. +

+
+ + + + + + )} +
+
+
+ ); +} diff --git a/apps/docs/content/components/modal/placement.ts b/apps/docs/content/components/modal/placement.ts index 626f888ee9..eee2244366 100644 --- a/apps/docs/content/components/modal/placement.ts +++ b/apps/docs/content/components/modal/placement.ts @@ -1,61 +1,4 @@ -const App = `import {Modal, ModalContent, ModalHeader, ModalBody, ModalFooter, Button, useDisclosure, RadioGroup, Radio} from "@nextui-org/react"; - -export default function App() { - const {isOpen, onOpen, onOpenChange} = useDisclosure(); - const [modalPlacement, setModalPlacement] = React.useState("auto"); - - return ( -
- - - auto - top - bottom - center - top-center - bottom-center - - - - {(onClose) => ( - <> - Modal Title - -

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. - Nullam pulvinar risus non risus hendrerit venenatis. - Pellentesque sit amet hendrerit risus, sed porttitor quam. -

-

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. - Nullam pulvinar risus non risus hendrerit venenatis. - Pellentesque sit amet hendrerit risus, sed porttitor quam. -

-
- - - - - - )} -
-
-
- ); -}`; +import App from "./placement.raw.jsx?raw"; const react = { "/App.jsx": App, diff --git a/apps/docs/content/components/modal/sizes.raw.jsx b/apps/docs/content/components/modal/sizes.raw.jsx new file mode 100644 index 0000000000..44857c1481 --- /dev/null +++ b/apps/docs/content/components/modal/sizes.raw.jsx @@ -0,0 +1,67 @@ +import { + Modal, + ModalContent, + ModalHeader, + ModalBody, + ModalFooter, + Button, + useDisclosure, +} from "@nextui-org/react"; + +export default function App() { + const {isOpen, onOpen, onClose} = useDisclosure(); + const [size, setSize] = React.useState("md"); + + const sizes = ["xs", "sm", "md", "lg", "xl", "2xl", "3xl", "4xl", "5xl", "full"]; + + const handleOpen = (size) => { + setSize(size); + onOpen(); + }; + + return ( + <> +
+ {sizes.map((size) => ( + + ))} +
+ + + {(onClose) => ( + <> + Modal Title + +

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pulvinar risus non + risus hendrerit venenatis. Pellentesque sit amet hendrerit risus, sed porttitor + quam. +

+

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pulvinar risus non + risus hendrerit venenatis. Pellentesque sit amet hendrerit risus, sed porttitor + quam. +

+

+ Magna exercitation reprehenderit magna aute tempor cupidatat consequat elit dolor + adipisicing. Mollit dolor eiusmod sunt ex incididunt cillum quis. Velit duis sit + officia eiusmod Lorem aliqua enim laboris do dolor eiusmod. +

+
+ + + + + + )} +
+
+ + ); +} diff --git a/apps/docs/content/components/modal/sizes.ts b/apps/docs/content/components/modal/sizes.ts index 53347ff38f..85a2f5b30b 100644 --- a/apps/docs/content/components/modal/sizes.ts +++ b/apps/docs/content/components/modal/sizes.ts @@ -1,65 +1,4 @@ -const App = `import {Modal, ModalContent, ModalHeader, ModalBody, ModalFooter, Button, useDisclosure} from "@nextui-org/react"; - -export default function App() { - const {isOpen, onOpen, onClose} = useDisclosure(); - const [size, setSize] = React.useState('md') - - const sizes = ["xs", "sm", "md", "lg", "xl", "2xl", "3xl", "4xl", "5xl", "full"]; - - - const handleOpen = (size) => { - setSize(size) - onOpen(); - } - - return ( - <> -
- {sizes.map((size) => ( - - ))} -
- - - {(onClose) => ( - <> - Modal Title - -

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. - Nullam pulvinar risus non risus hendrerit venenatis. - Pellentesque sit amet hendrerit risus, sed porttitor quam. -

-

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. - Nullam pulvinar risus non risus hendrerit venenatis. - Pellentesque sit amet hendrerit risus, sed porttitor quam. -

-

- Magna exercitation reprehenderit magna aute tempor cupidatat consequat elit - dolor adipisicing. Mollit dolor eiusmod sunt ex incididunt cillum quis. - Velit duis sit officia eiusmod Lorem aliqua enim laboris do dolor eiusmod. -

-
- - - - - - )} -
-
- - ); -}`; +import App from "./sizes.raw.jsx?raw"; const react = { "/App.jsx": App, diff --git a/apps/docs/content/components/modal/usage.raw.jsx b/apps/docs/content/components/modal/usage.raw.jsx new file mode 100644 index 0000000000..8c6bab9c69 --- /dev/null +++ b/apps/docs/content/components/modal/usage.raw.jsx @@ -0,0 +1,55 @@ +import { + Modal, + ModalContent, + ModalHeader, + ModalBody, + ModalFooter, + Button, + useDisclosure, +} from "@nextui-org/react"; + +export default function App() { + const {isOpen, onOpen, onOpenChange} = useDisclosure(); + + return ( + <> + + + + {(onClose) => ( + <> + Modal Title + +

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pulvinar risus non + risus hendrerit venenatis. Pellentesque sit amet hendrerit risus, sed porttitor + quam. +

+

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pulvinar risus non + risus hendrerit venenatis. Pellentesque sit amet hendrerit risus, sed porttitor + quam. +

+

+ Magna exercitation reprehenderit magna aute tempor cupidatat consequat elit dolor + adipisicing. Mollit dolor eiusmod sunt ex incididunt cillum quis. Velit duis sit + officia eiusmod Lorem aliqua enim laboris do dolor eiusmod. Et mollit incididunt + nisi consectetur esse laborum eiusmod pariatur proident Lorem eiusmod et. Culpa + deserunt nostrud ad veniam. +

+
+ + + + + + )} +
+
+ + ); +} diff --git a/apps/docs/content/components/modal/usage.ts b/apps/docs/content/components/modal/usage.ts index e0199aac0a..1118304c37 100644 --- a/apps/docs/content/components/modal/usage.ts +++ b/apps/docs/content/components/modal/usage.ts @@ -1,50 +1,4 @@ -const App = `import {Modal, ModalContent, ModalHeader, ModalBody, ModalFooter, Button, useDisclosure} from "@nextui-org/react"; - -export default function App() { - const {isOpen, onOpen, onOpenChange} = useDisclosure(); - - return ( - <> - - - - {(onClose) => ( - <> - Modal Title - -

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. - Nullam pulvinar risus non risus hendrerit venenatis. - Pellentesque sit amet hendrerit risus, sed porttitor quam. -

-

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. - Nullam pulvinar risus non risus hendrerit venenatis. - Pellentesque sit amet hendrerit risus, sed porttitor quam. -

-

- Magna exercitation reprehenderit magna aute tempor cupidatat consequat elit - dolor adipisicing. Mollit dolor eiusmod sunt ex incididunt cillum quis. - Velit duis sit officia eiusmod Lorem aliqua enim laboris do dolor eiusmod. - Et mollit incididunt nisi consectetur esse laborum eiusmod pariatur - proident Lorem eiusmod et. Culpa deserunt nostrud ad veniam. -

-
- - - - - - )} -
-
- - ); -}`; +import App from "./usage.raw.jsx?raw"; const react = { "/App.jsx": App, From 75ddf9cee0a87c92b4636fca39da0256b7c981e1 Mon Sep 17 00:00:00 2001 From: WK Wong Date: Sat, 16 Nov 2024 12:53:21 +0800 Subject: [PATCH 2/2] refactor(docs): modal dx --- .../content/components/modal/form.raw.jsx | 80 ++++++++++--------- apps/docs/content/docs/components/modal.mdx | 20 ++--- 2 files changed, 52 insertions(+), 48 deletions(-) diff --git a/apps/docs/content/components/modal/form.raw.jsx b/apps/docs/content/components/modal/form.raw.jsx index 0cdad526ab..07529d78a2 100644 --- a/apps/docs/content/components/modal/form.raw.jsx +++ b/apps/docs/content/components/modal/form.raw.jsx @@ -11,45 +11,49 @@ import { Link, } from "@nextui-org/react"; -export const MailIcon = (props) => ( - -); +export const MailIcon = (props) => { + return ( + + ); +}; -export const LockIcon = (props) => ( - -); +export const LockIcon = (props) => { + return ( + + ); +}; export default function App() { const {isOpen, onOpen, onOpenChange} = useDisclosure(); diff --git a/apps/docs/content/docs/components/modal.mdx b/apps/docs/content/docs/components/modal.mdx index 79a112fdd1..48042c1bef 100644 --- a/apps/docs/content/docs/components/modal.mdx +++ b/apps/docs/content/docs/components/modal.mdx @@ -42,19 +42,19 @@ NextUI exports 5 modal-related components: