260703_01_FST: First Commit
This commit is contained in:
45
.tooling/components/ui/dialog.tsx
Normal file
45
.tooling/components/ui/dialog.tsx
Normal file
@@ -0,0 +1,45 @@
|
||||
import type { HTMLAttributes, ReactNode } from "react";
|
||||
import { renderAsChild } from "@/lib/as-child";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export interface DialogProps {
|
||||
open?: boolean;
|
||||
onOpenChange?: (open: boolean) => void;
|
||||
children?: ReactNode;
|
||||
}
|
||||
|
||||
export function Dialog({ open, children }: DialogProps) {
|
||||
return open ? <>{children}</> : null;
|
||||
}
|
||||
|
||||
export function DialogClose({
|
||||
asChild,
|
||||
children,
|
||||
...props
|
||||
}: HTMLAttributes<HTMLElement> & { asChild?: boolean }) {
|
||||
return renderAsChild(asChild, children, props);
|
||||
}
|
||||
|
||||
export interface DialogContentProps extends HTMLAttributes<HTMLDivElement> {
|
||||
showCloseButton?: boolean;
|
||||
}
|
||||
|
||||
export function DialogContent({ className, showCloseButton, ...props }: DialogContentProps) {
|
||||
return <div role="dialog" data-show-close-button={showCloseButton} className={cn(className)} {...props} />;
|
||||
}
|
||||
|
||||
export function DialogHeader({ className, ...props }: HTMLAttributes<HTMLDivElement>) {
|
||||
return <div className={cn(className)} {...props} />;
|
||||
}
|
||||
|
||||
export function DialogFooter({ className, ...props }: HTMLAttributes<HTMLDivElement>) {
|
||||
return <div className={cn(className)} {...props} />;
|
||||
}
|
||||
|
||||
export function DialogTitle({ className, ...props }: HTMLAttributes<HTMLHeadingElement>) {
|
||||
return <h2 className={cn(className)} {...props} />;
|
||||
}
|
||||
|
||||
export function DialogDescription({ className, ...props }: HTMLAttributes<HTMLParagraphElement>) {
|
||||
return <p className={cn(className)} {...props} />;
|
||||
}
|
||||
Reference in New Issue
Block a user