Files
kolaytercih/src/components/ui/dialog.tsx
bilalgursen ff1e60f045 feat(cam): sıvı cam arayüzü ve footer'da camsı görünüm kutusu (→ 2.12.3)
Sıvı cam (Liquid Glass UI kitinden çevrildi): şeffaf cam CTA, "Giriş yap"
camı, kayan sekme merceği, "Yeni" rozeti, listeye ekleme ve ikon düğmeleri.
Footer'da tema seçicinin altına "Camsı görünüm" onay kutusu eklendi: işaret
kalkınca cam kurulmaz, her yüzey sade hâline döner; tercih tarayıcıda saklanır.
Yanında camın ilham kaynağı (GitHub profil resmi + liquid-glass deposu).
2.9.13 sonrası biriken sürümler (2.10.x–2.12.3) sürüm notlarında.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 21:27:35 +03:00

176 lines
5.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"use client"
import * as React from "react"
import { Dialog as DialogPrimitive } from "radix-ui"
import { cn } from "@/lib/utils"
import { Button } from "@/components/ui/button"
import { XIcon } from "lucide-react"
import { SIVI_KAP, SiviCam } from "@/components/sivi-cam";
function Dialog({
...props
}: React.ComponentProps<typeof DialogPrimitive.Root>) {
return <DialogPrimitive.Root data-slot="dialog" {...props} />
}
function DialogTrigger({
...props
}: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />
}
function DialogPortal({
...props
}: React.ComponentProps<typeof DialogPrimitive.Portal>) {
return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />
}
function DialogClose({
...props
}: React.ComponentProps<typeof DialogPrimitive.Close>) {
return <DialogPrimitive.Close data-slot="dialog-close" {...props} />
}
function DialogOverlay({
className,
...props
}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {
return (
<DialogPrimitive.Overlay
data-slot="dialog-overlay"
className={cn(
"fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",
className
)}
{...props}
/>
)
}
function DialogContent({
className,
children,
showCloseButton = true,
...props
}: React.ComponentProps<typeof DialogPrimitive.Content> & {
showCloseButton?: boolean
}) {
return (
<DialogPortal>
<DialogOverlay />
<DialogPrimitive.Content
data-slot="dialog-content"
className={cn(
// Modal yüzeyi = DESIGN.md §4.4 sade kutu (rounded-2xl, slate-200
// kenarlık, bg-card); shadcn'in ring'li rounded-xl/popover hâli
// sitede yoktu (10 Eki 2026, Bilal: "yeni dizayn anlayışımıza uygun
// değil"). Yazı tabanı gövde (16 px, §3); açıklama text-sm'i kendi taşır.
"fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-5 rounded-2xl border border-slate-200 bg-card p-6 text-slate-900 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:data-open:zoom-in-100 motion-reduce:data-closed:zoom-out-100",
className
)}
{...props}
>
{children}
{showCloseButton && (
<DialogPrimitive.Close
data-slot="dialog-close"
className={cn(SIVI_KAP, "kt-dokunma absolute top-3 right-3 z-10 flex size-9 cursor-pointer items-center justify-center rounded-full border border-slate-200 bg-popover text-slate-500 transition-[background-color,transform] duration-150 hover:bg-slate-100 hover:text-slate-800 active:scale-[0.96] data-cam:active:scale-100")}
>
<SiviCam />
<XIcon className="size-4" aria-hidden />
<span className="sr-only">Kapat</span>
</DialogPrimitive.Close>
)}
</DialogPrimitive.Content>
</DialogPortal>
)
}
function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="dialog-header"
className={cn("flex flex-col gap-2", className)}
{...props}
/>
)
}
function DialogFooter({
className,
showCloseButton = false,
children,
...props
}: React.ComponentProps<"div"> & {
showCloseButton?: boolean
}) {
return (
<div
data-slot="dialog-footer"
// Gri bant yok: aksiyonlar yüzeyin içinde, telefonda alt alta tam
// genişlik (ana aksiyon üstte), sm'den itibaren sağa yaslı yan yana.
className={cn(
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
className
)}
{...props}
>
{children}
{showCloseButton && (
<DialogPrimitive.Close asChild>
<Button variant="ikincil" size="lg">
Kapat
</Button>
</DialogPrimitive.Close>
)}
</div>
)
}
function DialogTitle({
className,
...props
}: React.ComponentProps<typeof DialogPrimitive.Title>) {
return (
<DialogPrimitive.Title
data-slot="dialog-title"
// Panel/kart h3 ölçeği (DESIGN.md §3): başlık her zaman bold Cal Sans
className={cn(
"font-heading text-xl leading-tight font-bold text-slate-900",
className
)}
{...props}
/>
)
}
function DialogDescription({
className,
...props
}: React.ComponentProps<typeof DialogPrimitive.Description>) {
return (
<DialogPrimitive.Description
data-slot="dialog-description"
className={cn(
"text-sm leading-relaxed text-slate-600 *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-orange-500",
className
)}
{...props}
/>
)
}
export {
Dialog,
DialogClose,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogOverlay,
DialogPortal,
DialogTitle,
DialogTrigger,
}