diff --git a/docs/components/supplier-faq-accordion.md b/docs/components/supplier-faq-accordion.md new file mode 100644 index 0000000..485bb02 --- /dev/null +++ b/docs/components/supplier-faq-accordion.md @@ -0,0 +1,171 @@ +# Supplier FAQ Accordion + +A searchable, deep-linkable FAQ accordion for the supplier profile, so buyers +can quickly find answers about pricing, policy, and process without leaving +the profile page. + +Component: [``](../../src/components/dashboard/supplier-faq-accordion.tsx) + +--- + +## When to use + +Use `` on any supplier-facing profile surface where a +buyer needs self-serve answers before booking or messaging a supplier: + +- **Supplier profile page** — below the hero and trust stats, ahead of + reviews. +- **Support / help drawers** — a scoped subset of entries filtered to a + single category (e.g. only `"Policy"` entries). + +--- + +## Anatomy + +``` +┌──────────────────────────────────────────────────────────┐ +│ SUPPLIER PROFILE │ +│ Frequently asked questions │ +│ Answers about pricing, policy, and process … │ +├──────────────────────────────────────────────────────────┤ +│ 🔍 Search questions and answers… [x] │ +│ Showing all 8 questions │ +│ ┌──────────────────────────────────────────────────────┐ │ +│ │ PRICING ⌄ │ │ +│ │ What currency is pricing shown in? │ │ +│ ├──────────────────────────────────────────────────────┤ │ +│ │ POLICY ⌃ │ │ +│ │ What is the refund policy? │ │ +│ │ Refunds are issued within 5 business days … │ │ +│ └──────────────────────────────────────────────────────┘ │ +└──────────────────────────────────────────────────────────┘ +``` + +- **Header**: `` provides the *eyebrow*, *title*, and + *description* slots (skip via `bare` when embedding elsewhere). +- **Search**: a labeled `role="searchbox"` input with a clear button once a + query is entered. Result count and matched-term highlighting update live. +- **List**: one `
  • ` per FAQ entry, each a WAI-ARIA disclosure — a + ` + ) : null} + + +

    + {showingAll + ? `Showing all ${entries.length} question${entries.length === 1 ? "" : "s"}` + : `${filteredEntries.length} of ${entries.length} question${entries.length === 1 ? "" : "s"} match`} +

    + + {announcement} + + {hasResults ? ( +
      + {filteredEntries.map((entry, index) => { + const isOpen = openIds.has(entry.id); + const headerId = `${baseId}-header-${entry.id}`; + const panelId = `${baseId}-panel-${entry.id}`; + const anchorId = `${idPrefix}${entry.id}`; + + return ( +
    • +

      + +

      + +
    • + ); + })} +
    + ) : ( +
    + No questions match “{query.trim()}”. Try a different term. +
    + )} + + ); + + if (bare) return content; + + return ( + + {content} + + ); +}