({ open, onClose, onTryDemo }: DemoGalleryProps)
| 15 | } |
| 16 | |
| 17 | export function DemoGallery({ open, onClose, onTryDemo }: DemoGalleryProps) { |
| 18 | const [selectedCategory, setSelectedCategory] = |
| 19 | useState<DemoCategory | null>(null); |
| 20 | |
| 21 | const filtered = selectedCategory |
| 22 | ? DEMO_EXAMPLES.filter((d) => d.category === selectedCategory) |
| 23 | : DEMO_EXAMPLES; |
| 24 | |
| 25 | useEffect(() => { |
| 26 | if (!open) return; |
| 27 | const handleKeyDown = (e: KeyboardEvent) => { |
| 28 | if (e.key === "Escape") onClose(); |
| 29 | }; |
| 30 | document.addEventListener("keydown", handleKeyDown); |
| 31 | return () => document.removeEventListener("keydown", handleKeyDown); |
| 32 | }, [open, onClose]); |
| 33 | |
| 34 | return ( |
| 35 | <> |
| 36 | {/* Backdrop */} |
| 37 | {open && ( |
| 38 | <div |
| 39 | className="fixed inset-0 z-40" |
| 40 | style={{ background: "rgba(0,0,0,0.3)", backdropFilter: "blur(2px)" }} |
| 41 | onClick={onClose} |
| 42 | /> |
| 43 | )} |
| 44 | |
| 45 | {/* Drawer: full-screen bottom sheet on mobile, right side panel on sm+ */} |
| 46 | <div |
| 47 | className={`demo-gallery-drawer fixed z-50 flex flex-col transition-transform duration-300 ease-in-out ${open ? "demo-gallery-drawer--open" : ""}`} |
| 48 | style={{ background: "var(--surface-primary, #fff)" }} |
| 49 | > |
| 50 | {/* Header */} |
| 51 | <div |
| 52 | className="flex items-center justify-between px-4 sm:px-5 py-3 sm:py-4 shrink-0" |
| 53 | style={{ |
| 54 | borderBottom: |
| 55 | "1px solid var(--color-border-glass, rgba(0,0,0,0.1))", |
| 56 | }} |
| 57 | > |
| 58 | <div className="flex items-center gap-2"> |
| 59 | <GridIcon size={18} style={{ color: "var(--text-secondary, #666)" }} /> |
| 60 | <h2 |
| 61 | className="text-base font-semibold" |
| 62 | style={{ color: "var(--text-primary, #1a1a1a)" }} |
| 63 | > |
| 64 | Demo Gallery |
| 65 | </h2> |
| 66 | <span |
| 67 | className="text-xs font-medium px-2 py-0.5 rounded-full" |
| 68 | style={{ |
| 69 | background: "var(--color-background-secondary, #f5f5f5)", |
| 70 | color: "var(--text-secondary, #666)", |
| 71 | }} |
| 72 | > |
| 73 | {DEMO_EXAMPLES.length} |
| 74 | </span> |
nothing calls this directly
no outgoing calls
no test coverage detected