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 DocumentationAtlas ContentSourcing 8 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  4628e010_da76_cf34_a78b_5c0b4ab8e1c2["drawer-dialog.tsx"]
  1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"]
  4628e010_da76_cf34_a78b_5c0b4ab8e1c2 --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2
  4544fa74_9b37_0912_c55e_f4ff161b8e83["button"]
  4628e010_da76_cf34_a78b_5c0b4ab8e1c2 --> 4544fa74_9b37_0912_c55e_f4ff161b8e83
  1302ba46_078b_fe14_24f5_044257f9b4d6["dialog"]
  4628e010_da76_cf34_a78b_5c0b4ab8e1c2 --> 1302ba46_078b_fe14_24f5_044257f9b4d6
  af96207b_3a7e_c8dc_285b_10654622127f["drawer"]
  4628e010_da76_cf34_a78b_5c0b4ab8e1c2 --> af96207b_3a7e_c8dc_285b_10654622127f
  9a309fc5_4306_d01f_08ce_72db23e48652["input"]
  4628e010_da76_cf34_a78b_5c0b4ab8e1c2 --> 9a309fc5_4306_d01f_08ce_72db23e48652
  e632ae84_c5fb_40c9_7b9d_82d10e757faf["label"]
  4628e010_da76_cf34_a78b_5c0b4ab8e1c2 --> e632ae84_c5fb_40c9_7b9d_82d10e757faf
  79081a1f_55a3_945a_fb8c_d53d6d3eab81["utils"]
  4628e010_da76_cf34_a78b_5c0b4ab8e1c2 --> 79081a1f_55a3_945a_fb8c_d53d6d3eab81
  5b9fe790_07fa_d673_2d62_394a21141145["use-media-query"]
  4628e010_da76_cf34_a78b_5c0b4ab8e1c2 --> 5b9fe790_07fa_d673_2d62_394a21141145
  style 4628e010_da76_cf34_a78b_5c0b4ab8e1c2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"use client"

import * as React from "react"
import { Button } from "@/examples/base/ui/button"
import {
  Dialog,
  DialogContent,
  DialogDescription,
  DialogHeader,
  DialogTitle,
  DialogTrigger,
} from "@/examples/base/ui/dialog"
import {
  Drawer,
  DrawerClose,
  DrawerContent,
  DrawerDescription,
  DrawerFooter,
  DrawerHeader,
  DrawerTitle,
  DrawerTrigger,
} from "@/examples/base/ui/drawer"
import { Input } from "@/examples/base/ui/input"
import { Label } from "@/examples/base/ui/label"

import { cn } from "@/lib/utils"
import { useMediaQuery } from "@/hooks/use-media-query"

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

  if (isDesktop) {
    return (
      <Dialog open={open} onOpenChange={setOpen}>
        <DialogTrigger render={<Button variant="outline" />}>
          Edit Profile
        </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 DocumentationAtlas domain, ContentSourcing 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/examples/base/drawer-dialog.tsx (domain: DocumentationAtlas, subdomain: ContentSourcing, directory: apps/v4/examples/base).

Analyze Your Own Codebase

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

Try Supermodel Free