Skip to content

Commit 9d1f75d

Browse files
committed
[Dashboard] Remove Drawer from mintTo form (#5263)
## Problem solved Short description of the bug fixed or feature added <!-- start pr-codex --> --- ## PR-Codex overview This PR focuses on refactoring the `NFTMintButton` and `NFTMintForm` components to replace the `Drawer` component from `@chakra-ui/react` with a `Sheet` component for improved UI consistency and functionality. ### Detailed summary - Replaced `Drawer` with `Sheet` in `NFTMintButton`. - Updated `SheetContent` class properties for better responsiveness. - Changed `SheetTitle` to have `text-left` class. - Added `setOpen` prop to `NFTMintForm` to control visibility. - Enhanced error handling with `toast` notifications. - Refined form structure and validation messages in `NFTMintForm`. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent 21d794c commit 9d1f75d

File tree

3 files changed

+198
-188
lines changed

3 files changed

+198
-188
lines changed
Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
"use client";
22

3+
import {
4+
Sheet,
5+
SheetContent,
6+
SheetHeader,
7+
SheetTitle,
8+
SheetTrigger,
9+
} from "@/components/ui/sheet";
310
import { MinterOnly } from "@3rdweb-sdk/react/components/roles/minter-only";
4-
import { useDisclosure } from "@chakra-ui/react";
511
import { PlusIcon } from "lucide-react";
12+
import { useState } from "react";
613
import type { ThirdwebContract } from "thirdweb";
7-
import { Button, Drawer } from "tw-components";
14+
import { Button } from "tw-components";
815
import { NFTMintForm } from "./mint-form";
916

1017
interface NFTMintButtonProps {
@@ -17,26 +24,31 @@ export const NFTMintButton: React.FC<NFTMintButtonProps> = ({
1724
isErc721,
1825
...restButtonProps
1926
}) => {
20-
const { isOpen, onOpen, onClose } = useDisclosure();
27+
const [open, setOpen] = useState(false);
28+
2129
return (
2230
<MinterOnly contract={contract}>
23-
<Drawer
24-
allowPinchZoom
25-
preserveScrollBarGap
26-
size="lg"
27-
onClose={onClose}
28-
isOpen={isOpen}
29-
>
30-
<NFTMintForm contract={contract} isErc721={isErc721} />
31-
</Drawer>
32-
<Button
33-
colorScheme="primary"
34-
leftIcon={<PlusIcon className="size-5" />}
35-
{...restButtonProps}
36-
onClick={onOpen}
37-
>
38-
Mint
39-
</Button>
31+
<Sheet open={open} onOpenChange={setOpen}>
32+
<SheetTrigger asChild>
33+
<Button
34+
colorScheme="primary"
35+
leftIcon={<PlusIcon className="size-5" />}
36+
{...restButtonProps}
37+
>
38+
Mint
39+
</Button>
40+
</SheetTrigger>
41+
<SheetContent className="w-full overflow-y-auto sm:min-w-[540px] lg:min-w-[700px]">
42+
<SheetHeader>
43+
<SheetTitle className="text-left">Mint NFT</SheetTitle>
44+
</SheetHeader>
45+
<NFTMintForm
46+
contract={contract}
47+
isErc721={isErc721}
48+
setOpen={setOpen}
49+
/>
50+
</SheetContent>
51+
</Sheet>
4052
</MinterOnly>
4153
);
4254
};

0 commit comments

Comments
 (0)