{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"dark-mode-toggle-with-live-page-preview","type":"registry:component","title":"Dark Mode Toggle With Live Page Preview","description":"","dependencies":[],"files":[{"path":"components/we-inc/dark-mode-toggle-with-live-page-preview.tsx","type":"registry:component","content":"import { useState } from \"react\";\n\n// A settings row whose switch also repaints a small preview of the page, so people see the result before leaving.\nfunction Preview({ dark }: { dark: boolean }) {\n  const c = dark\n    ? { page: \"bg-[#0b1220]\", bar: \"bg-[#111a2e]\", line: \"bg-slate-600\", head: \"bg-slate-200\", card: \"bg-[#16213a]\", accent: \"bg-sky-400\" }\n    : { page: \"bg-white\", bar: \"bg-slate-50\", line: \"bg-slate-200\", head: \"bg-slate-800\", card: \"bg-slate-100\", accent: \"bg-sky-600\" };\n  return (\n    <div aria-hidden=\"true\" className=\"overflow-hidden rounded-xl border border-slate-300 shadow-sm\">\n      <div className={`flex items-center gap-1.5 px-3 py-2 transition-colors duration-300 motion-reduce:transition-none ${c.bar}`}>\n        <span className=\"h-2 w-2 rounded-full bg-rose-400\" /><span className=\"h-2 w-2 rounded-full bg-amber-400\" /><span className=\"h-2 w-2 rounded-full bg-emerald-400\" />\n        <span className={`ml-3 h-2 w-24 rounded-full ${c.line}`} />\n      </div>\n      <div className={`space-y-3 p-4 transition-colors duration-300 motion-reduce:transition-none ${c.page}`}>\n        <div className={`h-3 w-2/3 rounded-full ${c.head}`} />\n        <div className={`h-2 w-full rounded-full ${c.line}`} />\n        <div className={`h-2 w-5/6 rounded-full ${c.line}`} />\n        <div className=\"grid grid-cols-3 gap-2 pt-1\">\n          {[0, 1, 2].map((i) => <div key={i} className={`h-12 rounded-lg transition-colors duration-300 motion-reduce:transition-none ${c.card}`} />)}\n        </div>\n        <div className={`h-7 w-24 rounded-md ${c.accent}`} />\n      </div>\n    </div>\n  );\n}\n\nexport default function DarkModeToggleWithLivePagePreview() {\n  const [dark, setDark] = useState(true);\n  return (\n    <section className=\"bg-slate-100 px-5 py-14\">\n      <div className=\"mx-auto grid max-w-3xl items-center gap-8 rounded-2xl border border-slate-200 bg-white p-6 sm:grid-cols-2 sm:p-8\">\n        <div>\n          <h2 className=\"text-lg font-semibold text-slate-900\">Reader theme</h2>\n          <p className=\"mt-1 text-sm text-slate-600\">Choose how the Northwind Ledger articles look on this device.</p>\n          <label className=\"mt-6 flex min-h-[44px] cursor-pointer items-center justify-between gap-4 rounded-xl border border-slate-200 px-4 py-2\">\n            <span className=\"text-sm font-medium text-slate-800\">Dark reading mode</span>\n            <input type=\"checkbox\" role=\"switch\" aria-label=\"Dark reading mode\" checked={dark} onChange={(e) => setDark(e.target.checked)} className=\"peer sr-only\" />\n            <span aria-hidden=\"true\" className=\"relative h-7 w-12 shrink-0 rounded-full bg-slate-300 transition-colors peer-checked:bg-sky-600 peer-focus-visible:ring-2 peer-focus-visible:ring-sky-600 peer-focus-visible:ring-offset-2 motion-reduce:transition-none after:absolute after:left-1 after:top-1 after:h-5 after:w-5 after:rounded-full after:bg-white after:shadow after:transition-transform peer-checked:after:translate-x-5 motion-reduce:after:transition-none\" />\n          </label>\n          <p className=\"mt-3 text-sm text-slate-600\" aria-live=\"polite\">Preview shows the {dark ? \"dark\" : \"light\"} theme.</p>\n        </div>\n        <Preview dark={dark} />\n      </div>\n    </section>\n  );\n}\n"}]}
