Skip to main content
Glama
dialog.tsx4.07 kB
import * as React from "react"; import * as DialogPrimitive from "@radix-ui/react-dialog"; import { Button } from "./button"; import { twMerge } from "tailwind-merge"; import clsx from "clsx"; const Dialog = DialogPrimitive.Root; const DialogTrigger = DialogPrimitive.Trigger; const DialogPortal = ({ children, ...props }: DialogPrimitive.DialogPortalProps) => ( <DialogPrimitive.Portal {...props}> <div className="fixed inset-0 z-50 flex items-start justify-center sm:items-center"> {children} </div> </DialogPrimitive.Portal> ); DialogPortal.displayName = DialogPrimitive.Portal.displayName; const DialogOverlay = React.forwardRef< React.ElementRef<typeof DialogPrimitive.Overlay>, React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay> >(({ className, ...props }, ref) => ( <DialogPrimitive.Overlay ref={ref} className={twMerge( clsx( "fixed inset-0 z-50 bg-black/40 dark:bg-white/20 backdrop-blur-sm transition-all duration-100 data-[state=closed]:animate-out data-[state=closed]:fade-out data-[state=open]:fade-in", className ) )} {...props} /> )); DialogOverlay.displayName = DialogPrimitive.Overlay.displayName; const DialogContent = React.forwardRef< React.ElementRef<typeof DialogPrimitive.Content>, React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> >(({ className, children, ...props }, ref) => ( <DialogPortal> <DialogOverlay /> <DialogPrimitive.Content ref={ref} className={twMerge( clsx( "fixed max-h-[90vh] overflow-auto z-50 block w-full rounded-b-md border bg-white dark:bg-slate-900 border-gray-200 dark:border-gray-900 shadow-xl animate-in data-[state=open]:fade-in-90 data-[state=open]:slide-in-from-bottom-10 sm:max-w-2xl sm:rounded-xl sm:zoom-in-90 data-[state=open]:sm:slide-in-from-bottom-0", className ) )} {...props} > {children} <DialogPrimitive.Close className="absolute right-2 top-2 rounded-full p-0 ring-purple-100 dark:ring-purple-200/10 transition-opacity hover:opacity-100 focus:outline-none focus:ring-4 focus:ring-ring focus:ring-offset-0 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground"> <Button icon="RiCloseLine" variant="tertiary" className="rounded-full" tabIndex={-1} /> </DialogPrimitive.Close> </DialogPrimitive.Content> </DialogPortal> )); DialogContent.displayName = DialogPrimitive.Content.displayName; const DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => ( <div className={twMerge( clsx("flex flex-col space-y-1.5 text-center sm:text-left", className) )} {...props} /> ); DialogHeader.displayName = "DialogHeader"; const DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => ( <div className={twMerge( clsx( "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className ) )} {...props} /> ); DialogFooter.displayName = "DialogFooter"; const DialogTitle = React.forwardRef< React.ElementRef<typeof DialogPrimitive.Title>, React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title> >(({ className, ...props }, ref) => ( <DialogPrimitive.Title ref={ref} className={twMerge(clsx("text-xl font-semibold", className))} {...props} /> )); DialogTitle.displayName = DialogPrimitive.Title.displayName; const DialogDescription = React.forwardRef< React.ElementRef<typeof DialogPrimitive.Description>, React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description> >(({ className, ...props }, ref) => ( <DialogPrimitive.Description ref={ref} className={twMerge(clsx("text-sm text-muted-foreground", className))} {...props} /> )); DialogDescription.displayName = DialogPrimitive.Description.displayName; export { Dialog, DialogTrigger, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription, };

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mobile-dev-inc/Maestro'

If you have feedback or need assistance with the MCP directory API, please join our Discord server