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
  3ff1eefd_a481_9e9d_e87b_0e3710e11ec5["drawer-dialog.tsx"]
  1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"]
  3ff1eefd_a481_9e9d_e87b_0e3710e11ec5 --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2
  79081a1f_55a3_945a_fb8c_d53d6d3eab81["utils"]
  3ff1eefd_a481_9e9d_e87b_0e3710e11ec5 --> 79081a1f_55a3_945a_fb8c_d53d6d3eab81
  5b9fe790_07fa_d673_2d62_394a21141145["use-media-query"]
  3ff1eefd_a481_9e9d_e87b_0e3710e11ec5 --> 5b9fe790_07fa_d673_2d62_394a21141145
  57e86e45_ac6e_7278_be08_9092724e8401["button"]
  3ff1eefd_a481_9e9d_e87b_0e3710e11ec5 --> 57e86e45_ac6e_7278_be08_9092724e8401
  0896a8fa_5462_a73a_5add_fb8176921778["dialog"]
  3ff1eefd_a481_9e9d_e87b_0e3710e11ec5 --> 0896a8fa_5462_a73a_5add_fb8176921778
  538a1992_2e44_c995_0fe9_493e88eb6ea5["drawer"]
  3ff1eefd_a481_9e9d_e87b_0e3710e11ec5 --> 538a1992_2e44_c995_0fe9_493e88eb6ea5
  80cf663d_a411_487c_d69e_ac9d405cd2ec["input"]
  3ff1eefd_a481_9e9d_e87b_0e3710e11ec5 --> 80cf663d_a411_487c_d69e_ac9d405cd2ec
  d752035b_6ed3_c6ef_e27c_eef51af9ec8d["label"]
  3ff1eefd_a481_9e9d_e87b_0e3710e11ec5 --> d752035b_6ed3_c6ef_e27c_eef51af9ec8d
  style 3ff1eefd_a481_9e9d_e87b_0e3710e11ec5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"use client"

import * as React from "react"

import { cn } from "@/lib/utils"
import { useMediaQuery } from "@/hooks/use-media-query"
import { Button } from "@/registry/new-york-v4/ui/button"
import {
  Dialog,
  DialogContent,
  DialogDescription,
  DialogHeader,
  DialogTitle,
  DialogTrigger,
} from "@/registry/new-york-v4/ui/dialog"
import {
  Drawer,
  DrawerClose,
  DrawerContent,
  DrawerDescription,
  DrawerFooter,
  DrawerHeader,
  DrawerTitle,
  DrawerTrigger,
} from "@/registry/new-york-v4/ui/drawer"
import { Input } from "@/registry/new-york-v4/ui/input"
import { Label } from "@/registry/new-york-v4/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&apos;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&apos;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-6", className)}>
      <div className="grid gap-3">
        <Label htmlFor="email">Email</Label>
        <Input type="email" id="email" defaultValue="shadcn@example.com" />
      </div>
      <div className="grid gap-3">
        <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 apps/v4/registry/new-york-v4/examples/drawer-dialog.tsx (domain: ComponentRegistry, subdomain: ChartRegistry, directory: apps/v4/registry/new-york-v4/examples).

Analyze Your Own Codebase

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

Try Supermodel Free