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
  d985c2ec_fc62_9820_0684_efd00d7df8c3["drawer-dialog.tsx"]
  1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"]
  d985c2ec_fc62_9820_0684_efd00d7df8c3 --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2
  79081a1f_55a3_945a_fb8c_d53d6d3eab81["utils"]
  d985c2ec_fc62_9820_0684_efd00d7df8c3 --> 79081a1f_55a3_945a_fb8c_d53d6d3eab81
  5b9fe790_07fa_d673_2d62_394a21141145["use-media-query"]
  d985c2ec_fc62_9820_0684_efd00d7df8c3 --> 5b9fe790_07fa_d673_2d62_394a21141145
  aa2f3ec6_f291_3763_88ec_65a3f5ad5939["button"]
  d985c2ec_fc62_9820_0684_efd00d7df8c3 --> aa2f3ec6_f291_3763_88ec_65a3f5ad5939
  4dc8bbf9_c114_4bfa_0f89_4ae4ccd0ae1e["dialog"]
  d985c2ec_fc62_9820_0684_efd00d7df8c3 --> 4dc8bbf9_c114_4bfa_0f89_4ae4ccd0ae1e
  79b170ee_6170_9271_c7a0_b5527f29a7e1["drawer"]
  d985c2ec_fc62_9820_0684_efd00d7df8c3 --> 79b170ee_6170_9271_c7a0_b5527f29a7e1
  2de1d0e1_ab37_e1b0_4ef3_da8c8fa66107["input"]
  d985c2ec_fc62_9820_0684_efd00d7df8c3 --> 2de1d0e1_ab37_e1b0_4ef3_da8c8fa66107
  fa665cdb_5f79_b81a_95ab_12ba182fc175["label"]
  d985c2ec_fc62_9820_0684_efd00d7df8c3 --> fa665cdb_5f79_b81a_95ab_12ba182fc175
  style d985c2ec_fc62_9820_0684_efd00d7df8c3 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/new-york/ui/button"
import {
  Dialog,
  DialogContent,
  DialogDescription,
  DialogHeader,
  DialogTitle,
  DialogTrigger,
} from "@/registry/new-york/ui/dialog"
import {
  Drawer,
  DrawerClose,
  DrawerContent,
  DrawerDescription,
  DrawerFooter,
  DrawerHeader,
  DrawerTitle,
  DrawerTrigger,
} from "@/registry/new-york/ui/drawer"
import { Input } from "@/registry/new-york/ui/input"
import { Label } from "@/registry/new-york/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/new-york/examples/drawer-dialog.tsx (domain: ComponentRegistry, subdomain: ChartRegistry, directory: deprecated/www/registry/new-york/examples).

Analyze Your Own Codebase

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

Try Supermodel Free