import "./components/ui/tidal.css"; import { useState, type FormEvent, type MouseEvent } from "react"; import { TidalFooterFeedback, type TidalFooterFeedbackNavGroup } from "./components/ui/footer-feedback"; import type { TidalFeedbackChoice, TidalFeedbackReason } from "./components/ui/response-feedback"; import "./components/ui/response-feedback.css"; import "./components/ui/footer-feedback.css"; const tidalExampleStyles = ".tidal-scope .footer-pilot-05-demo,\n.tidal-scope .footer-pilot-05-demo-shell {\n min-inline-size: 0;\n inline-size: 100%;\n}"; const reasons: readonly TidalFeedbackReason[] = [ { id: "unclear", label: "The explanation was unclear" }, { id: "missing", label: "A step was missing" }, { id: "example", label: "I needed another example" }, ]; const navigationGroups: readonly TidalFooterFeedbackNavGroup[] = [ { id: "docs", label: "Docs", links: [ { id: "components", label: "Components", href: "#preview-components" }, { id: "guides", label: "Guides", href: "#preview-guides" }, { id: "api", label: "API reference", href: "#preview-api" }, ], }, { id: "help", label: "Help", links: [ { id: "accessibility", label: "Accessibility", href: "#preview-accessibility", }, { id: "support", label: "Support", href: "#preview-support" }, ], }, ]; function handlePreviewClick( label: string, setStatus: (status: string) => void, ) { return (event: MouseEvent) => { if ( event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.currentTarget.target ) { return; } event.preventDefault(); setStatus(`${label} selected in this local preview.`); }; } export function FooterFeedbackDemo() { const [choice, setChoice] = useState(null); const [selectedReasons, setSelectedReasons] = useState([]); const [comment, setComment] = useState(""); const [completed, setCompleted] = useState(false); const [lastChoice, setLastChoice] = useState("No preview feedback selected."); const previewNavigationGroups = navigationGroups.map((group) => ({ ...group, links: group.links.map((link) => ({ ...link, onClick: handlePreviewClick(String(link.label), setLastChoice), })), })); function handleChoice( next: TidalFeedbackChoice, _event: MouseEvent, ) { setChoice(next); setLastChoice( next === "helpful" ? "Helpful selected in local preview." : "Not helpful selected in local preview.", ); } function handleSubmit(event: FormEvent) { event.preventDefault(); setCompleted(true); setLastChoice("Local preview complete. No feedback was sent or stored."); } return (
TidalUI } heading="Was this page useful?" feedbackTitle="Page feedback" description="Help us improve this guide." completionMessage="Thanks for checking this page. This preview did not send or store a response." completed={completed} feedback={{ choice, onChoiceChange: handleChoice, reasons, selectedReasons, onReasonsChange: setSelectedReasons, comment, onCommentChange: setComment, onSubmit: handleSubmit, labels: { submit: "Complete preview" }, }} navigationGroups={previewNavigationGroups} legal={© 2026 TidalUI preview} status={{lastChoice}} />
); } export default function AgentExample() { return (
); }