mirror of
https://github.com/shadcn-ui/ui.git
synced 2026-06-30 16:14:13 +00:00
117 lines
3.8 KiB
TypeScript
117 lines
3.8 KiB
TypeScript
"use client"
|
|
|
|
import { useState } from "react"
|
|
import { Button } from "@/examples/base/ui/button"
|
|
import {
|
|
Dialog,
|
|
DialogClose,
|
|
DialogContent,
|
|
DialogDescription,
|
|
DialogFooter,
|
|
DialogHeader,
|
|
DialogTitle,
|
|
} from "@/examples/base/ui/dialog"
|
|
import {
|
|
DropdownMenu,
|
|
DropdownMenuContent,
|
|
DropdownMenuGroup,
|
|
DropdownMenuItem,
|
|
DropdownMenuLabel,
|
|
DropdownMenuTrigger,
|
|
} from "@/examples/base/ui/dropdown-menu"
|
|
import { Field, FieldGroup, FieldLabel } from "@/examples/base/ui/field"
|
|
import { Input } from "@/examples/base/ui/input"
|
|
import { Label } from "@/examples/base/ui/label"
|
|
import { Textarea } from "@/examples/base/ui/textarea"
|
|
import { MoreHorizontalIcon } from "lucide-react"
|
|
|
|
export function DropdownMenuDialog() {
|
|
const [showNewDialog, setShowNewDialog] = useState(false)
|
|
const [showShareDialog, setShowShareDialog] = useState(false)
|
|
|
|
return (
|
|
<>
|
|
<DropdownMenu modal={false}>
|
|
<DropdownMenuTrigger
|
|
render={
|
|
<Button variant="outline" aria-label="Open menu" size="icon-sm" />
|
|
}
|
|
>
|
|
<MoreHorizontalIcon />
|
|
</DropdownMenuTrigger>
|
|
<DropdownMenuContent className="w-40" align="end">
|
|
<DropdownMenuGroup>
|
|
<DropdownMenuLabel>File Actions</DropdownMenuLabel>
|
|
<DropdownMenuItem onSelect={() => setShowNewDialog(true)}>
|
|
New File...
|
|
</DropdownMenuItem>
|
|
<DropdownMenuItem onSelect={() => setShowShareDialog(true)}>
|
|
Share...
|
|
</DropdownMenuItem>
|
|
<DropdownMenuItem disabled>Download</DropdownMenuItem>
|
|
</DropdownMenuGroup>
|
|
</DropdownMenuContent>
|
|
</DropdownMenu>
|
|
<Dialog open={showNewDialog} onOpenChange={setShowNewDialog}>
|
|
<DialogContent className="sm:max-w-[425px]">
|
|
<DialogHeader>
|
|
<DialogTitle>Create New File</DialogTitle>
|
|
<DialogDescription>
|
|
Provide a name for your new file. Click create when you're
|
|
done.
|
|
</DialogDescription>
|
|
</DialogHeader>
|
|
<FieldGroup className="pb-3">
|
|
<Field>
|
|
<FieldLabel htmlFor="filename">File Name</FieldLabel>
|
|
<Input id="filename" name="filename" placeholder="document.txt" />
|
|
</Field>
|
|
</FieldGroup>
|
|
<DialogFooter>
|
|
<DialogClose render={<Button variant="outline" />}>
|
|
Cancel
|
|
</DialogClose>
|
|
<Button type="submit">Create</Button>
|
|
</DialogFooter>
|
|
</DialogContent>
|
|
</Dialog>
|
|
<Dialog open={showShareDialog} onOpenChange={setShowShareDialog}>
|
|
<DialogContent className="sm:max-w-[425px]">
|
|
<DialogHeader>
|
|
<DialogTitle>Share File</DialogTitle>
|
|
<DialogDescription>
|
|
Anyone with the link will be able to view this file.
|
|
</DialogDescription>
|
|
</DialogHeader>
|
|
<FieldGroup className="py-3">
|
|
<Field>
|
|
<Label htmlFor="email">Email Address</Label>
|
|
<Input
|
|
id="email"
|
|
name="email"
|
|
type="email"
|
|
placeholder="shadcn@vercel.com"
|
|
autoComplete="off"
|
|
/>
|
|
</Field>
|
|
<Field>
|
|
<FieldLabel htmlFor="message">Message (Optional)</FieldLabel>
|
|
<Textarea
|
|
id="message"
|
|
name="message"
|
|
placeholder="Check out this file"
|
|
/>
|
|
</Field>
|
|
</FieldGroup>
|
|
<DialogFooter>
|
|
<DialogClose render={<Button variant="outline" />}>
|
|
Cancel
|
|
</DialogClose>
|
|
<Button type="submit">Send Invite</Button>
|
|
</DialogFooter>
|
|
</DialogContent>
|
|
</Dialog>
|
|
</>
|
|
)
|
|
}
|