{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "news-feed-shadcnui", "type": "registry:component", "title": "News Feed", "description": "Interactive news feed with categories, search, and animated cards", "registryDependencies": [ "button" ], "dependencies": [ "framer-motion", "react" ], "files": [ { "path": "@uitripled/react-shadcn/src/components/components/news-feed/news-feed.tsx", "content": "\"use client\";\n\nimport { Avatar, AvatarFallback, AvatarImage } from \"@/components/ui/avatar\";\nimport { Badge } from \"@/components/ui/badge\";\nimport { Button } from \"@/components/ui/button\";\nimport { Input } from \"@/components/ui/input\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport {\n ArrowRight,\n Bookmark,\n Clock,\n Filter,\n MessageSquare,\n MoreHorizontal,\n Newspaper,\n Search,\n Share2,\n TrendingUp,\n} from \"lucide-react\";\nimport { useState } from \"react\";\n\n// ============================================================================\n// TYPES\n// ============================================================================\n\ninterface NewsItem {\n id: string;\n title: string;\n summary: string;\n category: \"Technology\" | \"Design\" | \"Business\" | \"AI\" | \"Crypto\";\n author: {\n name: string;\n avatar: string;\n role: string;\n };\n publishedAt: string;\n readTime: string;\n likes: number;\n comments: number;\n trending?: boolean;\n image?: string;\n}\n\n// ============================================================================\n// DUMMY DATA\n// ============================================================================\n\nconst NEWS_ITEMS: NewsItem[] = [\n {\n id: \"1\",\n title: \"The Future of AI in Modern Interface Design\",\n summary:\n \"How artificial intelligence is reshaping the way we interact with digital products and the role of designers in this new era.\",\n category: \"AI\",\n author: {\n name: \"Sarah Chen\",\n avatar: \"https://i.pravatar.cc/150?u=sarah\",\n role: \"Product Designer\",\n },\n publishedAt: \"2h ago\",\n readTime: \"5 min read\",\n likes: 1240,\n comments: 86,\n trending: true,\n image:\n \"https://images.unsplash.com/photo-1677442136019-21780ecad995?auto=format&fit=crop&q=80&w=1000\",\n },\n {\n id: \"2\",\n title: \"WebAssembly: The Next Big Thing in Web Development?\",\n summary:\n \"Exploring the potential of WebAssembly to bring desktop-class performance to the web browser.\",\n category: \"Technology\",\n author: {\n name: \"Alex Rivera\",\n avatar: \"https://i.pravatar.cc/150?u=alex\",\n role: \"Senior Dev\",\n },\n publishedAt: \"4h ago\",\n readTime: \"8 min read\",\n likes: 856,\n comments: 42,\n },\n {\n id: \"3\",\n title: \"Sustainable Tech: Building Green Software\",\n summary:\n \"Why energy efficiency in code matters and how developers can contribute to a more sustainable future.\",\n category: \"Technology\",\n author: {\n name: \"Emma Wilson\",\n avatar: \"https://i.pravatar.cc/150?u=emma\",\n role: \"Tech Lead\",\n },\n publishedAt: \"5h ago\",\n readTime: \"6 min read\",\n likes: 623,\n comments: 28,\n },\n {\n id: \"4\",\n title: \"Crypto Markets See Unprecedented Growth\",\n summary:\n \"Analysis of the latest market trends and what it means for institutional investors.\",\n category: \"Crypto\",\n author: {\n name: \"Michael Chang\",\n avatar: \"https://i.pravatar.cc/150?u=michael\",\n role: \"Financial Analyst\",\n },\n publishedAt: \"6h ago\",\n readTime: \"4 min read\",\n likes: 2100,\n comments: 154,\n trending: true,\n },\n {\n id: \"5\",\n title: \"Minimalism in 2024: Less is Still More\",\n summary:\n \"A look at how minimalist design principles are evolving in the current digital landscape.\",\n category: \"Design\",\n author: {\n name: \"Jessica Kim\",\n avatar: \"https://i.pravatar.cc/150?u=jessica\",\n role: \"UX Researcher\",\n },\n publishedAt: \"8h ago\",\n readTime: \"3 min read\",\n likes: 445,\n comments: 19,\n },\n];\n\nconst CATEGORIES = [\"All\", \"Technology\", \"Design\", \"Business\", \"AI\", \"Crypto\"];\n\n// ============================================================================\n// COMPONENTS\n// ============================================================================\n\nfunction NewsCard({ item, index }: { item: NewsItem; index: number }) {\n return (\n \n {/* Hover Gradient */}\n
\n\n
\n {/* Header: Author & Meta */}\n
\n
\n \n \n {item.author.name[0]}\n \n
\n \n {item.author.name}\n \n \n {item.author.role}\n \n
\n
\n
\n {item.trending && (\n \n \n Trending\n \n )}\n \n \n {item.publishedAt}\n \n
\n
\n\n {/* Content */}\n
\n
\n

\n {item.title}\n

\n \n {item.category}\n \n
\n

\n {item.summary}\n

\n
\n\n {/* Footer: Actions & Stats */}\n
\n
\n \n \n
\n\n
\n \n {item.readTime}\n \n \n \n \n \n \n \n
\n
\n
\n \n );\n}\n\nexport function NewsFeed() {\n const [activeCategory, setActiveCategory] = useState(\"All\");\n const [searchQuery, setSearchQuery] = useState(\"\");\n\n const filteredNews = NEWS_ITEMS.filter((item) => {\n const matchesCategory =\n activeCategory === \"All\" || item.category === activeCategory;\n const matchesSearch =\n item.title.toLowerCase().includes(searchQuery.toLowerCase()) ||\n item.summary.toLowerCase().includes(searchQuery.toLowerCase());\n return matchesCategory && matchesSearch;\n });\n\n return (\n
\n {/* Header Section */}\n
\n
\n

\n \n Latest Updates\n

\n

\n Stay informed with the most recent news and insights.\n

\n
\n\n
\n
\n \n setSearchQuery(e.target.value)}\n />\n
\n \n
\n
\n\n {/* Categories */}\n
\n {CATEGORIES.map((category) => (\n setActiveCategory(category)}\n className={`\n px-4 py-1.5 rounded-full text-xs font-medium transition-all whitespace-nowrap\n ${\n activeCategory === category\n ? \"bg-primary text-primary-foreground shadow-md shadow-primary/20\"\n : \"bg-secondary/50 text-secondary-foreground hover:bg-secondary hover:text-foreground border border-transparent hover:border-border/50\"\n }\n `}\n >\n {category}\n \n ))}\n
\n\n {/* News Grid */}\n
\n \n {filteredNews.length > 0 ? (\n filteredNews.map((item, index) => (\n \n ))\n ) : (\n \n
\n \n
\n

\n No news found matching your criteria.\n

\n {\n setActiveCategory(\"All\");\n setSearchQuery(\"\");\n }}\n >\n Clear filters\n \n \n )}\n
\n
\n\n {/* Load More */}\n {filteredNews.length > 0 && (\n
\n \n \n Load More Stories\n \n
\n )}\n
\n );\n}\n", "type": "registry:component", "target": "components/uitripled/news-feed-shadcnui.tsx" } ] }