{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"two-column-booking-form-with-select-and-date","type":"registry:component","title":"Two Column Booking Form With Select and Date","description":"","dependencies":[],"files":[{"path":"components/we-inc/two-column-booking-form-with-select-and-date.tsx","type":"registry:component","content":"import { useState, type FormEvent } from \"react\";\n\nconst COTTAGES = [\"The Byre, sleeps 2\", \"Hayloft, sleeps 4\", \"Mill House, sleeps 6\"];\nconst RATE: Record<string, number> = { [COTTAGES[0]]: 120, [COTTAGES[1]]: 165, [COTTAGES[2]]: 240 };\n\nexport default function TwoColumnBookingForm() {\n  const [cottage, setCottage] = useState(COTTAGES[1]);\n  const [arrive, setArrive] = useState(\"2026-11-13\");\n  const [nights, setNights] = useState(3);\n  const [sent, setSent] = useState(false);\n\n  const nice = arrive ? new Date(arrive + \"T12:00:00\").toLocaleDateString(\"en-GB\", { weekday: \"short\", day: \"numeric\", month: \"short\" }) : \"\";\n  const total = RATE[cottage] * nights;\n\n  const label = \"text-sm font-medium text-stone-800\";\n  const ctl = \"mt-1.5 block h-11 w-full rounded-md border border-stone-300 bg-white px-3 text-sm text-stone-900 focus:border-orange-700 focus:outline-none focus:ring-2 focus:ring-orange-200\";\n\n  return (\n    <section className=\"bg-stone-100 px-4 py-16\">\n      <form\n        onSubmit={(e: FormEvent) => { e.preventDefault(); setSent(true); }}\n        className=\"mx-auto max-w-3xl overflow-hidden rounded-2xl bg-white ring-1 ring-stone-200\"\n      >\n        <div className=\"border-b border-stone-200 bg-orange-50/60 px-6 py-5 sm:px-8\">\n          <h2 className=\"text-xl font-semibold tracking-tight text-stone-900\">Book a stay at Brackenfold Farm</h2>\n          <p className=\"mt-1 text-sm text-stone-700\">Three stone cottages in the hills. Arrivals from 4pm, Monday and Friday changeovers.</p>\n        </div>\n\n        <div className=\"grid gap-x-5 gap-y-5 px-6 py-6 sm:grid-cols-2 sm:px-8\">\n          <fieldset className=\"contents\">\n            <legend className=\"sr-only\">Your stay</legend>\n            <div className=\"sm:col-span-2\">\n              <label htmlFor=\"tcbf-cottage\" className={label}>Cottage</label>\n              <select id=\"tcbf-cottage\" value={cottage} onChange={(e) => setCottage(e.target.value)} className={ctl}>\n                {COTTAGES.map((c) => <option key={c}>{c}</option>)}\n              </select>\n            </div>\n            <div>\n              <label htmlFor=\"tcbf-arrive\" className={label}>Arrival date</label>\n              <input id=\"tcbf-arrive\" type=\"date\" required min=\"2026-10-30\" value={arrive} onChange={(e) => setArrive(e.target.value)} className={ctl} />\n            </div>\n            <div>\n              <label htmlFor=\"tcbf-nights\" className={label}>Nights</label>\n              <select id=\"tcbf-nights\" value={nights} onChange={(e) => setNights(Number(e.target.value))} className={ctl}>\n                {[2, 3, 4, 7].map((n) => <option key={n} value={n}>{n} nights</option>)}\n              </select>\n            </div>\n          </fieldset>\n          <fieldset className=\"contents\">\n            <legend className=\"sr-only\">Lead guest</legend>\n            <div>\n              <label htmlFor=\"tcbf-name\" className={label}>Full name</label>\n              <input id=\"tcbf-name\" required autoComplete=\"name\" defaultValue=\"Hannah Rowe\" className={ctl} />\n            </div>\n            <div>\n              <label htmlFor=\"tcbf-phone\" className={label}>Phone <span className=\"font-normal text-stone-600\">(for arrival day)</span></label>\n              <input id=\"tcbf-phone\" type=\"tel\" autoComplete=\"tel\" placeholder=\"07700 900 123\" className={`${ctl} placeholder:text-stone-500`} />\n            </div>\n            <div className=\"sm:col-span-2\">\n              <label htmlFor=\"tcbf-notes\" className={label}>Anything we should know?</label>\n              <textarea id=\"tcbf-notes\" rows={3} placeholder=\"Dogs, cots, late arrival\" className={`${ctl} h-auto py-2.5 placeholder:text-stone-500`} />\n            </div>\n          </fieldset>\n        </div>\n\n        <div className=\"flex flex-col gap-4 border-t border-stone-200 bg-stone-50 px-6 py-5 sm:flex-row sm:items-center sm:justify-between sm:px-8\">\n          <p className=\"text-sm text-stone-700\" aria-live=\"polite\">\n            {nights} nights from {nice} <span className=\"mx-1 text-stone-400\" aria-hidden=\"true\">/</span>\n            <span className=\"font-semibold text-stone-900\">&pound;{total}</span>\n          </p>\n          <button type=\"submit\" className=\"h-11 rounded-md bg-orange-800 px-6 text-sm font-semibold text-white hover:bg-orange-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-orange-800 focus-visible:ring-offset-2\">\n            {sent ? \"Request sent\" : \"Request booking\"}\n          </button>\n        </div>\n      </form>\n    </section>\n  );\n}\n"}]}
