mirror of
https://github.com/nextui-org/nextui.git
synced 2025-12-08 19:26:11 +00:00
* feat(hooks): add use-draggable hook * feat(components): [modal] export use-draggable * docs(components): [modal] add draggable modal * feat(components): [modal] add ref prop for modal-header * chore(components): [modal] add draggable modal for storybook * chore: add changeset for draggable modal * docs(hooks): [use-draggable] fix typo * chore: upper changeset * chore(components): [modal] add overflow draggable modal to sb * test(components): [modal] add draggable modal tests * build: update pnpm-lock * chore(changeset): include issue number * feat(hooks): [use-draggable] set user-select to none when during the dragging * docs(components): [modal] update code demo title * docs(components): [modal] condense description for draggable overflow * feat(hooks): [use-draggable] change version to 0.1.0 * refactor(hooks): [use-draggable] use use-move implement use-draggable * feat(hooks): [use-draggable] remove repeated user-select * test(components): [modal] update test case to use-draggable base use-move * docs(components): [modal] update draggable examples * fix(hooks): [use-draggable] fix mobile device touchmove event conflict * refactor(hooks): [use-draggable] remove drag ref prop * refactor(hooks): [use-draggable] draggable2is-disabled overflow2can-overflow * test(components): [modal] add draggble disable test * chore(hooks): [use-draggable] add commant for body touchmove * Update packages/hooks/use-draggable/src/index.ts Co-authored-by: Ryo Matsukawa <76232929+ryo-manba@users.noreply.github.com> * fix(hooks): [use-draggable] import use-callback * test(components): [modal] add mobile-sized test for draggable * chore(hooks): [use-draggable] add use-callback for func * chore(hooks): [use-draggable] update version to 2.0.0 * chore: fix typo * Update .changeset/soft-apricots-sleep.md * fix: pnpm lock * fix: build * chore: add updated moadl --------- Co-authored-by: wzc520pyfm <1528857653@qq.com> Co-authored-by: աɨռɢӄաօռɢ <wingkwong.code@gmail.com> Co-authored-by: Ryo Matsukawa <76232929+ryo-manba@users.noreply.github.com>
46 lines
1.4 KiB
TypeScript
46 lines
1.4 KiB
TypeScript
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 (
|
|
<>
|
|
<Button onPress={onOpen}>Open Modal</Button>
|
|
<Modal ref={targetRef} isOpen={isOpen} onOpenChange={onOpenChange}>
|
|
<ModalContent>
|
|
{(onClose) => (
|
|
<>
|
|
<ModalHeader {...moveProps} 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>
|
|
</ModalBody>
|
|
<ModalFooter>
|
|
<Button color="danger" variant="light" onPress={onClose}>
|
|
Close
|
|
</Button>
|
|
<Button color="primary" onPress={onClose}>
|
|
Action
|
|
</Button>
|
|
</ModalFooter>
|
|
</>
|
|
)}
|
|
</ModalContent>
|
|
</Modal>
|
|
</>
|
|
);
|
|
}`;
|
|
|
|
const react = {
|
|
"/App.jsx": App,
|
|
};
|
|
|
|
export default {
|
|
...react,
|
|
};
|