| // src/components/dashboard/TrendingTopics.tsx | |
| import { Link } from "react-router-dom"; | |
| import { TrendingUp, Sparkles, Hash, Flame, ArrowRight } from "lucide-react"; | |
| interface TrendingTopicsProps { | |
| topics: string[]; | |
| } | |
| export function TrendingTopics({ topics: rawTopics }: TrendingTopicsProps) { | |
| const topics = Array.isArray(rawTopics) ? rawTopics : []; | |
| const displayTopics = topics.slice(0, 10); | |
| return ( | |
| <div className="rounded-[2rem] border border-slate-200 bg-white p-5 shadow-sm dark:border-slate-700 dark:bg-slate-800"> | |
| <div className="mb-4 flex flex-wrap items-start justify-between gap-3"> | |
| <div> | |
| <div className="inline-flex items-center gap-2 rounded-full bg-sky-50 px-3 py-1 text-xs font-semibold text-sky-700 dark:bg-sky-950/40 dark:text-sky-300"> | |
| <Sparkles className="h-3.5 w-3.5" /> | |
| What people are reading | |
| </div> | |
| <h2 className="mt-3 flex items-center gap-2 text-xl font-semibold text-slate-900 dark:text-white"> | |
| <TrendingUp className="h-5 w-5 text-primary" /> Trending Topics | |
| </h2> | |
| <p className="mt-1 text-sm text-slate-500 dark:text-slate-400"> | |
| Topics that are getting attention in your community right now. | |
| </p> | |
| </div> | |
| <Link to="/trending" className="inline-flex items-center gap-1 text-sm font-medium text-primary hover:underline"> | |
| View all <ArrowRight className="h-4 w-4" /> | |
| </Link> | |
| </div> | |
| {displayTopics.length === 0 ? ( | |
| <div className="rounded-[1.75rem] border border-dashed border-slate-200 bg-slate-50/80 p-6 text-center dark:border-slate-700 dark:bg-slate-900/60"> | |
| <Hash className="mx-auto h-10 w-10 text-slate-400" /> | |
| <p className="mt-2 text-sm font-medium text-slate-700 dark:text-slate-200">No trending topics yet</p> | |
| <p className="mt-1 text-xs text-slate-500 dark:text-slate-400"> | |
| As articles and discussions grow, the hottest tags will show up here. | |
| </p> | |
| </div> | |
| ) : ( | |
| <div className="flex flex-wrap gap-2"> | |
| {displayTopics.map((topic, index) => ( | |
| <Link | |
| key={topic} | |
| to={`/articles?tag=${encodeURIComponent(topic)}`} | |
| className={`inline-flex items-center gap-2 rounded-full px-3.5 py-2 text-sm font-medium transition hover:-translate-y-0.5 ${ | |
| index < 3 | |
| ? "bg-primary text-white shadow-sm shadow-primary/20 hover:bg-primary/90" | |
| : "bg-slate-100 text-slate-700 hover:bg-slate-200 dark:bg-slate-700 dark:text-slate-200 dark:hover:bg-slate-600" | |
| }`} | |
| > | |
| {index < 3 ? <Flame className="h-3.5 w-3.5" /> : <Hash className="h-3.5 w-3.5 opacity-70" />} | |
| <span>#{topic}</span> | |
| <span className="text-[10px] opacity-70">{index + 1}</span> | |
| </Link> | |
| ))} | |
| </div> | |
| )} | |
| <div className="mt-4 flex flex-wrap gap-2 text-xs text-slate-500 dark:text-slate-400"> | |
| <span className="inline-flex items-center gap-1 rounded-full bg-slate-50 px-3 py-1 dark:bg-slate-900/70"> | |
| <Flame className="h-3.5 w-3.5 text-orange-500" /> | |
| Hot topics rise to the top | |
| </span> | |
| <span className="inline-flex items-center gap-1 rounded-full bg-slate-50 px-3 py-1 dark:bg-slate-900/70"> | |
| <Sparkles className="h-3.5 w-3.5 text-sky-500" /> | |
| Tap any tag to browse related articles | |
| </span> | |
| </div> | |
| </div> | |
| ); | |
| } | |
Xet Storage Details
- Size:
- 3.54 kB
- Xet hash:
- c6ac77a7ac9a1e5b0bb812e51db44361bab3fc814ba9989f7e0fcacc3a7bc7cc
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.