;; SX docs — documentation page components (defcomp ~doc-page (&key title &rest children) (div :class "max-w-4xl mx-auto px-6 py-8" (h1 :class "text-4xl font-bold text-stone-900 mb-8" title) (div :class "prose prose-stone max-w-none space-y-6" children))) (defcomp ~doc-section (&key title id &rest children) (section :id id :class "space-y-4" (h2 :class "text-2xl font-semibold text-stone-800" title) children)) (defcomp ~doc-subsection (&key title &rest children) (div :class "space-y-3" (h3 :class "text-xl font-semibold text-stone-700" title) children)) (defcomp ~doc-code (&key language code) (div :class "bg-stone-900 rounded-lg p-4 overflow-x-auto" (pre :class "text-sm" (code :class (str "language-" (or language "lisp")) code)))) (defcomp ~doc-note (&key &rest children) (div :class "border-l-4 border-violet-400 bg-violet-50 p-4 text-stone-700 text-sm" children)) (defcomp ~doc-table (&key headers rows) (div :class "overflow-x-auto rounded border border-stone-200" (table :class "w-full text-left text-sm" (thead (tr :class "border-b border-stone-200 bg-stone-50" (map (fn (h) (th :class "px-3 py-2 font-medium text-stone-600" h)) headers))) (tbody (map (fn (row) (tr :class "border-b border-stone-100" (map (fn (cell) (td :class "px-3 py-2 text-stone-700" cell)) row))) rows))))) (defcomp ~doc-attr-row (&key attr description exists) (tr :class "border-b border-stone-100" (td :class "px-3 py-2 font-mono text-sm text-violet-700 whitespace-nowrap" attr) (td :class "px-3 py-2 text-stone-700 text-sm" description) (td :class "px-3 py-2 text-center" (if exists (span :class "text-emerald-600 text-sm" "yes") (span :class "text-stone-400 text-sm italic" "not yet"))))) (defcomp ~doc-primitives-table (&key category primitives) (div :class "space-y-2" (h4 :class "text-lg font-semibold text-stone-700" category) (div :class "flex flex-wrap gap-2" (map (fn (p) (span :class "inline-block px-2 py-1 rounded bg-stone-100 font-mono text-sm text-stone-700" p)) primitives)))) (defcomp ~doc-nav (&key items current) (nav :class "flex flex-wrap gap-2 mb-8" (map (fn (item) (a :href (nth 1 item) :sx-get (nth 1 item) :sx-target "#main-panel" :sx-select "#main-panel" :sx-swap "outerHTML" :sx-push-url "true" :class (str "px-3 py-1.5 rounded text-sm font-medium no-underline " (if (= (nth 0 item) current) "bg-violet-100 text-violet-800" "bg-stone-100 text-stone-600 hover:bg-stone-200")) (nth 0 item))) items)))