import React, { useState, useMemo } from "react"; import { motion, AnimatePresence } from "framer-motion"; import { Search, X, Filter, Inbox, ChevronRight, Sparkles, Layers, Clock, ArrowUpDown, Tag, } from "lucide-react"; export interface ListItem { id: string; title: string; category: "Design" | "Engineering" | "Marketing" | "Product"; updatedAt: string; status: "Active" | "Draft" | "Archived"; author: string; } const mockItems: ListItem[] = [ { id: "1", title: "Toss UI Design Tokens v4", category: "Design", updatedAt: "2 hours ago", status: "Active", author: "Alex Rivera", }, { id: "2", title: "Framer Motion Spring Presets", category: "Engineering", updatedAt: "1 day ago", status: "Active", author: "Sarah Chen", }, { id: "3", title: "Q3 Product Roadmap Pitch", category: "Product", updatedAt: "3 days ago", status: "Draft", author: "Jordan Lee", }, { id: "4", title: "StyleSeed Brand Guidelines", category: "Marketing", updatedAt: "5 days ago", status: "Archived", author: "Taylor Kim", }, { id: "5", title: "WCAG 2.1 Accessibility Audit Checklist", category: "Design", updatedAt: "1 week ago", status: "Active", author: "Alex Rivera", }, ]; const springPhysics = { type: "spring", stiffness: 380, damping: 26, }; export default function DataListPattern() { const [searchQuery, setSearchQuery] = useState(""); const [selectedCategory, setSelectedCategory] = useState("All"); const [isLoading, setIsLoading] = useState(false); const categories = ["All", "Design", "Engineering", "Marketing", "Product"]; // Filter items dynamically const filteredItems = useMemo(() => { return mockItems.filter((item) => { const matchesSearch = item.title.toLowerCase().includes(searchQuery.toLowerCase()) || item.author.toLowerCase().includes(searchQuery.toLowerCase()); const matchesCategory = selectedCategory === "All" || item.category === selectedCategory; return matchesSearch && matchesCategory; }); }, [searchQuery, selectedCategory]); const handleSimulateReload = () => { setIsLoading(true); setTimeout(() => setIsLoading(false), 1200); }; return (
{/* Pattern Header */}

Data List Pattern

Filterable content list with live search, animated layout changes, and WCAG AA focus.

{/* Filter and Search Toolbar */}
{/* Search Input */}
{/* Category Filter Chips */}
{categories.map((cat) => { const isSelected = selectedCategory === cat; return ( ); })}
{/* List Content */}
{/* Loading State */} {isLoading ? (
{[1, 2, 3].map((i) => (
))}
) : filteredItems.length === 0 ? ( /* Empty State */

No matching results found

Try adjusting your search keywords or switching category filters.

{(searchQuery || selectedCategory !== "All") && ( )}
) : ( /* Populated List Items with Spring Motion */ {filteredItems.map((item) => (

{item.title}

{item.status}
{item.category} {item.updatedAt} By {item.author}
))}
)}
{/* Footer Meta Summary */}
); }