"use client"; import { useSyncExternalStore } from "react"; import { useTheme } from "next-themes"; import { Monitor, Moon, Sun } from "lucide-react"; import { Kbd } from "@/components/ui/kbd"; import { temayiGecisle } from "@/lib/tema-gecisi"; import { cn } from "@/lib/utils"; const SECENEKLER = [ { deger: "light", etiket: "Açık", ikon: Sun }, { deger: "dark", etiket: "Koyu", ikon: Moon }, { deger: "system", etiket: "Sistem", ikon: Monitor }, ] as const; const aboneOlma = () => () => {}; /** * Tema seçici: açık / koyu / sistem (DESIGN.md §2.3). Seçili tema yalnızca * tarayıcıda bilinir; sunucu HTML'inde hiçbir seçenek işaretli gelmez, * hydration sonrası işaretlenir (yerleşim oynamaz). Seçim logodan piksel piksel * yayılarak uygulanır (lib/tema-gecisi.ts); altında `D` kısayolu ipucu durur. */ export function TemaSecici({ className }: { className?: string }) { const { theme, setTheme } = useTheme(); const tarayicida = useSyncExternalStore( aboneOlma, () => true, () => false, ); return (
{SECENEKLER.map(({ deger, etiket, ikon: Ikon }) => { const secili = tarayicida && theme === deger; return ( ); })}

D ile açık / koyu arasında geç

); }