Home / File/ drawer-dialog.tsx — ui Source File

drawer-dialog.tsx — ui Source File

Architecture documentation for drawer-dialog.tsx, a tsx file in the ui codebase. 8 imports, 0 dependents.

File tsx ComponentRegistry ChartRegistry 8 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  a4637e2d_18e2_a7c9_49de_d83845d2bc95["drawer-dialog.tsx"]
  1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"]
  a4637e2d_18e2_a7c9_49de_d83845d2bc95 --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2
  79081a1f_55a3_945a_fb8c_d53d6d3eab81["utils"]
  a4637e2d_18e2_a7c9_49de_d83845d2bc95 --> 79081a1f_55a3_945a_fb8c_d53d6d3eab81
  5b9fe790_07fa_d673_2d62_394a21141145["use-media-query"]
  a4637e2d_18e2_a7c9_49de_d83845d2bc95 --> 5b9fe790_07fa_d673_2d62_394a21141145
  d418ad18_b947_f4e5_6e4c_01100d7a63e4["button"]
  a4637e2d_18e2_a7c9_49de_d83845d2bc95 --> d418ad18_b947_f4e5_6e4c_01100d7a63e4
  885f582a_05b5_deff_0779_e9bfb6fad47b["dialog"]
  a4637e2d_18e2_a7c9_49de_d83845d2bc95 --> 885f582a_05b5_deff_0779_e9bfb6fad47b
  e03b2544_1b68_470f_14f0_dfbd84c9df9b["drawer"]
  a4637e2d_18e2_a7c9_49de_d83845d2bc95 --> e03b2544_1b68_470f_14f0_dfbd84c9df9b
  163b5f6f_1cd3_6d8d_5305_80eec4895f60["input"]
  a4637e2d_18e2_a7c9_49de_d83845d2bc95 --> 163b5f6f_1cd3_6d8d_5305_80eec4895f60
  f826d306_7d63_5ba3_6a53_387904d37a9f["label"]
  a4637e2d_18e2_a7c9_49de_d83845d2bc95 --> f826d306_7d63_5ba3_6a53_387904d37a9f
  style a4637e2d_18e2_a7c9_49de_d83845d2bc95 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import * as React from "react"

import { cn } from "@/lib/utils"
import { useMediaQuery } from "@/hooks/use-media-query"
import { Button } from "@/registry/default/ui/button"
import {
  Dialog,
  DialogContent,
  DialogDescription,
  DialogHeader,
  DialogTitle,
  DialogTrigger,
} from "@/registry/default/ui/dialog"
import {
  Drawer,
  DrawerClose,
  DrawerContent,
  DrawerDescription,
  DrawerFooter,
  DrawerHeader,
  DrawerTitle,
  DrawerTrigger,
} from "@/registry/default/ui/drawer"
import { Input } from "@/registry/default/ui/input"
import { Label } from "@/registry/default/ui/label"

export default function DrawerDialogDemo() {
  const [open, setOpen] = React.useState(false)
  const isDesktop = useMediaQuery("(min-width: 768px)")

  if (isDesktop) {
    return (
      <Dialog open={open} onOpenChange={setOpen}>
        <DialogTrigger asChild>
          <Button variant="outline">Edit Profile</Button>
        </DialogTrigger>
        <DialogContent className="sm:max-w-[425px]">
          <DialogHeader>
            <DialogTitle>Edit profile</DialogTitle>
            <DialogDescription>
              Make changes to your profile here. Click save when you're done.
            </DialogDescription>
          </DialogHeader>
          <ProfileForm />
        </DialogContent>
      </Dialog>
    )
  }

  return (
    <Drawer open={open} onOpenChange={setOpen}>
      <DrawerTrigger asChild>
        <Button variant="outline">Edit Profile</Button>
      </DrawerTrigger>
      <DrawerContent>
        <DrawerHeader className="text-left">
          <DrawerTitle>Edit profile</DrawerTitle>
          <DrawerDescription>
            Make changes to your profile here. Click save when you're done.
          </DrawerDescription>
        </DrawerHeader>
        <ProfileForm className="px-4" />
        <DrawerFooter className="pt-2">
          <DrawerClose asChild>
            <Button variant="outline">Cancel</Button>
          </DrawerClose>
        </DrawerFooter>
      </DrawerContent>
    </Drawer>
  )
}

function ProfileForm({ className }: React.ComponentProps<"form">) {
  return (
    <form className={cn("grid items-start gap-4", className)}>
      <div className="grid gap-2">
        <Label htmlFor="email">Email</Label>
        <Input type="email" id="email" defaultValue="shadcn@example.com" />
      </div>
      <div className="grid gap-2">
        <Label htmlFor="username">Username</Label>
        <Input id="username" defaultValue="@shadcn" />
      </div>
      <Button type="submit">Save changes</Button>
    </form>
  )
}

Subdomains

Dependencies

  • button
  • dialog
  • drawer
  • input
  • label
  • react
  • use-media-query
  • utils

Frequently Asked Questions

What does drawer-dialog.tsx do?
drawer-dialog.tsx is a source file in the ui codebase, written in tsx. It belongs to the ComponentRegistry domain, ChartRegistry subdomain.
What functions are defined in drawer-dialog.tsx?
drawer-dialog.tsx defines 2 function(s): DrawerDialogDemo, ProfileForm.
What does drawer-dialog.tsx depend on?
drawer-dialog.tsx imports 8 module(s): button, dialog, drawer, input, label, react, use-media-query, utils.
Where is drawer-dialog.tsx in the architecture?
drawer-dialog.tsx is located at deprecated/www/registry/default/examples/drawer-dialog.tsx (domain: ComponentRegistry, subdomain: ChartRegistry, directory: deprecated/www/registry/default/examples).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free