Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(drawer): export drawer children props #4310

Merged
merged 6 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/forty-ducks-brake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nextui-org/drawer": patch
---

Export useDisclosure and Drawer children props from `@nextui-org/drawer`
17 changes: 16 additions & 1 deletion packages/components/drawer/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
import {ModalHeader, ModalBody, ModalFooter, ModalContent} from "@nextui-org/modal";
import {
ModalHeader,
ModalBody,
ModalFooter,
ModalContent,
type ModalContentProps,
type ModalHeaderProps,
type ModalBodyProps,
type ModalFooterProps,
} from "@nextui-org/modal";
Comment on lines +1 to +10
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Use top-level type imports for better consistency

Convert inline type specifiers to top-level type imports to follow TypeScript best practices and maintain consistency.

Apply this change:

-import {
-  ModalHeader,
-  ModalBody,
-  ModalFooter,
-  ModalContent,
-  type ModalContentProps,
-  type ModalHeaderProps,
-  type ModalBodyProps,
-  type ModalFooterProps,
-} from "@nextui-org/modal";
+import {
+  ModalHeader,
+  ModalBody,
+  ModalFooter,
+  ModalContent,
+} from "@nextui-org/modal";
+import type {
+  ModalContentProps,
+  ModalHeaderProps,
+  ModalBodyProps,
+  ModalFooterProps,
+} from "@nextui-org/modal";
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import {
ModalHeader,
ModalBody,
ModalFooter,
ModalContent,
type ModalContentProps,
type ModalHeaderProps,
type ModalBodyProps,
type ModalFooterProps,
} from "@nextui-org/modal";
import {
ModalHeader,
ModalBody,
ModalFooter,
ModalContent,
} from "@nextui-org/modal";
import type {
ModalContentProps,
ModalHeaderProps,
ModalBodyProps,
ModalFooterProps,
} from "@nextui-org/modal";
🧰 Tools
🪛 eslint

[error] 6-6: Prefer using a top-level type-only import instead of inline type specifiers.

(import/consistent-type-specifier-style)


[error] 7-7: Prefer using a top-level type-only import instead of inline type specifiers.

(import/consistent-type-specifier-style)


[error] 8-8: Prefer using a top-level type-only import instead of inline type specifiers.

(import/consistent-type-specifier-style)


[error] 9-9: Prefer using a top-level type-only import instead of inline type specifiers.

(import/consistent-type-specifier-style)


import Drawer from "./drawer";

// export types
export type {DrawerProps} from "./drawer";
export type {
ModalContentProps as DrawerContentProps,
ModalHeaderProps as DrawerHeaderProps,
ModalBodyProps as DrawerBodyProps,
ModalFooterProps as DrawerFooterProps,
};

// export hooks
export {useDrawer} from "./use-drawer";
Expand Down