Skip to content

Commit

Permalink
[Dashboard] Remove Drawer from mintTo form
Browse files Browse the repository at this point in the history
  • Loading branch information
kien-ngo committed Nov 1, 2024
1 parent b031c36 commit cf3c54b
Show file tree
Hide file tree
Showing 3 changed files with 198 additions and 188 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
"use client";

import {
Sheet,
SheetContent,
SheetHeader,
SheetTitle,
SheetTrigger,
} from "@/components/ui/sheet";
import { MinterOnly } from "@3rdweb-sdk/react/components/roles/minter-only";
import { useDisclosure } from "@chakra-ui/react";
import { PlusIcon } from "lucide-react";
import { useState } from "react";
import type { ThirdwebContract } from "thirdweb";
import { Button, Drawer } from "tw-components";
import { Button } from "tw-components";
import { NFTMintForm } from "./mint-form";

interface NFTMintButtonProps {
Expand All @@ -17,26 +24,31 @@ export const NFTMintButton: React.FC<NFTMintButtonProps> = ({
isErc721,
...restButtonProps
}) => {
const { isOpen, onOpen, onClose } = useDisclosure();
const [open, setOpen] = useState(false);

return (
<MinterOnly contract={contract}>
<Drawer
allowPinchZoom
preserveScrollBarGap
size="lg"
onClose={onClose}
isOpen={isOpen}
>
<NFTMintForm contract={contract} isErc721={isErc721} />
</Drawer>
<Button
colorScheme="primary"
leftIcon={<PlusIcon className="size-5" />}
{...restButtonProps}
onClick={onOpen}
>
Mint
</Button>
<Sheet open={open} onOpenChange={setOpen}>
<SheetTrigger asChild>
<Button
colorScheme="primary"
leftIcon={<PlusIcon className="size-5" />}
{...restButtonProps}
>
Mint
</Button>
</SheetTrigger>
<SheetContent className="w-full overflow-y-auto sm:min-w-[540px] lg:min-w-[700px]">
<SheetHeader>
<SheetTitle className="text-left">Mint NFT</SheetTitle>
</SheetHeader>
<NFTMintForm
contract={contract}
isErc721={isErc721}
setOpen={setOpen}
/>
</SheetContent>
</Sheet>
</MinterOnly>
);
};
Loading

0 comments on commit cf3c54b

Please sign in to comment.