-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor(docs): modal dx * refactor(docs): modal dx
- Loading branch information
Showing
26 changed files
with
1,043 additions
and
900 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,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 ( | ||
<> | ||
<div className="flex flex-wrap gap-3"> | ||
{backdrops.map((b) => ( | ||
<Button | ||
key={b} | ||
className="capitalize" | ||
color="warning" | ||
variant="flat" | ||
onPress={() => handleOpen(b)} | ||
> | ||
{b} | ||
</Button> | ||
))} | ||
</div> | ||
<Modal backdrop={backdrop} isOpen={isOpen} onClose={onClose}> | ||
<ModalContent> | ||
{(onClose) => ( | ||
<> | ||
<ModalHeader className="flex flex-col gap-1">Modal Title</ModalHeader> | ||
<ModalBody> | ||
<p> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pulvinar risus non | ||
risus hendrerit venenatis. Pellentesque sit amet hendrerit risus, sed porttitor | ||
quam. | ||
</p> | ||
<p> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pulvinar risus non | ||
risus hendrerit venenatis. Pellentesque sit amet hendrerit risus, sed porttitor | ||
quam. | ||
</p> | ||
<p> | ||
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. | ||
</p> | ||
</ModalBody> | ||
<ModalFooter> | ||
<Button color="danger" variant="light" onPress={onClose}> | ||
Close | ||
</Button> | ||
<Button color="primary" onPress={onClose}> | ||
Action | ||
</Button> | ||
</ModalFooter> | ||
</> | ||
)} | ||
</ModalContent> | ||
</Modal> | ||
</> | ||
); | ||
} |
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
62 changes: 62 additions & 0 deletions
62
apps/docs/content/components/modal/custom-backdrop.raw.jsx
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,62 @@ | ||
import { | ||
Modal, | ||
ModalContent, | ||
ModalHeader, | ||
ModalBody, | ||
ModalFooter, | ||
Button, | ||
useDisclosure, | ||
} from "@nextui-org/react"; | ||
|
||
export default function App() { | ||
const {isOpen, onOpen, onOpenChange} = useDisclosure(); | ||
|
||
return ( | ||
<> | ||
<Button onPress={onOpen}>Open Modal</Button> | ||
<Modal | ||
backdrop="opaque" | ||
classNames={{ | ||
backdrop: "bg-gradient-to-t from-zinc-900 to-zinc-900/10 backdrop-opacity-20", | ||
}} | ||
isOpen={isOpen} | ||
onOpenChange={onOpenChange} | ||
> | ||
<ModalContent> | ||
{(onClose) => ( | ||
<> | ||
<ModalHeader className="flex flex-col gap-1">Modal Title</ModalHeader> | ||
<ModalBody> | ||
<p> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pulvinar risus non | ||
risus hendrerit venenatis. Pellentesque sit amet hendrerit risus, sed porttitor | ||
quam. | ||
</p> | ||
<p> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pulvinar risus non | ||
risus hendrerit venenatis. Pellentesque sit amet hendrerit risus, sed porttitor | ||
quam. | ||
</p> | ||
<p> | ||
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. | ||
</p> | ||
</ModalBody> | ||
<ModalFooter> | ||
<Button color="danger" variant="light" onPress={onClose}> | ||
Close | ||
</Button> | ||
<Button color="primary" onPress={onClose}> | ||
Action | ||
</Button> | ||
</ModalFooter> | ||
</> | ||
)} | ||
</ModalContent> | ||
</Modal> | ||
</> | ||
); | ||
} |
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 |
---|---|---|
@@ -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 ( | ||
<> | ||
<Button onPress={onOpen}>Open Modal</Button> | ||
<Modal | ||
backdrop="opaque" | ||
isOpen={isOpen} | ||
motionProps={{ | ||
variants: { | ||
enter: { | ||
y: 0, | ||
opacity: 1, | ||
transition: { | ||
duration: 0.3, | ||
ease: "easeOut", | ||
}, | ||
}, | ||
exit: { | ||
y: -20, | ||
opacity: 0, | ||
transition: { | ||
duration: 0.2, | ||
ease: "easeIn", | ||
}, | ||
}, | ||
}, | ||
}} | ||
onOpenChange={onOpenChange} | ||
> | ||
<ModalContent> | ||
{(onClose) => ( | ||
<> | ||
<ModalHeader className="flex flex-col gap-1">Modal Title</ModalHeader> | ||
<ModalBody> | ||
<p> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pulvinar risus non | ||
risus hendrerit venenatis. Pellentesque sit amet hendrerit risus, sed porttitor | ||
quam. | ||
</p> | ||
<p> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pulvinar risus non | ||
risus hendrerit venenatis. Pellentesque sit amet hendrerit risus, sed porttitor | ||
quam. | ||
</p> | ||
<p> | ||
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. | ||
</p> | ||
</ModalBody> | ||
<ModalFooter> | ||
<Button color="danger" variant="light" onPress={onClose}> | ||
Close | ||
</Button> | ||
<Button color="primary" onPress={onClose}> | ||
Action | ||
</Button> | ||
</ModalFooter> | ||
</> | ||
)} | ||
</ModalContent> | ||
</Modal> | ||
</> | ||
); | ||
} |
Oops, something went wrong.