diff --git a/docs/catalog-gallery.css b/docs/catalog-gallery.css index e17a4625e9..4714a5ed71 100644 --- a/docs/catalog-gallery.css +++ b/docs/catalog-gallery.css @@ -79,6 +79,24 @@ @media(prefers-reduced-motion:reduce){.hfc-gallery .mw .sq path{stroke-dashoffset:0;}} @media(max-width:600px){.hfc-gallery{padding:0 18px;}.hfc-gallery .hfc-hero{padding:28px 0;}} +/* The catalog's own search: filters the cards below as you type. */ +.hfc-search { + display: block; + width: min(560px, 100%); + margin-top: 18px; + padding: 12px 16px; + border: 1px solid color-mix(in srgb, currentColor 18%, transparent); + border-radius: 999px; + background: color-mix(in srgb, currentColor 4%, transparent); + color: inherit; + font: inherit; + font-size: 15px; +} +.hfc-search:focus-visible { + outline: 2px solid color-mix(in srgb, currentColor 40%, transparent); + outline-offset: 2px; +} + /* Pause previews: the visitor's stop for the looping cards. */ .hfc-gallery .hfc-pause { margin-top: 14px; diff --git a/docs/snippets/catalog-gallery.jsx b/docs/snippets/catalog-gallery.jsx index 7ffc412f34..fbf1be2015 100644 --- a/docs/snippets/catalog-gallery.jsx +++ b/docs/snippets/catalog-gallery.jsx @@ -251,6 +251,9 @@ export const CatalogGallery = ({ catalog, initialGroup = "", initialSection = "" React.createElement(MotionWord, null), " ready to install."), React.createElement("p", null, initialGroup ? `${matches.length} items. Preview a piece and open it to explore its controls, code, and installation.` : "Find the scene, caption, or finishing touch for your next video. Preview the motion, pick a favorite, and make it your own."), + // The filter already reads ?q=; this is the place to type it. Every keystroke filters in memory, and the + // URL keeps the words so a search can be shared. + React.createElement("input", { className: "hfc-search", type: "search", value: filters.q, onChange: (event) => update({ q: event.target.value }), placeholder: `Search ${items.length || ""} items: captions, charts, 3D, transitions…`.replace(" ", " "), "aria-label": "Search the catalog" }), !still && React.createElement("button", { type: "button", className: "hfc-pause", "aria-pressed": paused, onClick: togglePaused }, paused ? "Play previews" : "Pause previews")), React.createElement("section", { className: "hfc-browser", "aria-label": "Browse catalog", ref: resultsRef }, searching ? React.createElement(React.Fragment, null, matches.length ? React.createElement("div", { className: "hfc-grid" }, matches.slice(0, limit).map((item) => card(item))) : React.createElement("div", { className: "hfc-empty" },