| 6 | import { TOOLS } from './tools'; |
| 7 | |
| 8 | export default function ToolsSidebar(): React.ReactElement { |
| 9 | const pathname = usePathname(); |
| 10 | |
| 11 | return ( |
| 12 | <aside> |
| 13 | <div className="lg:sticky lg:top-24"> |
| 14 | <nav className="space-y-2"> |
| 15 | {TOOLS.map((tool) => { |
| 16 | const Icon = tool.icon; |
| 17 | const isActive = pathname === tool.url; |
| 18 | return ( |
| 19 | <Link |
| 20 | key={tool.url} |
| 21 | href={tool.url} |
| 22 | className={cn( |
| 23 | 'flex items-start gap-3 p-3 rounded-lg transition-colors', |
| 24 | isActive |
| 25 | ? 'bg-accent text-accent-foreground' |
| 26 | : 'hover:bg-accent/50 text-muted-foreground hover:text-foreground', |
| 27 | )} |
| 28 | > |
| 29 | <Icon className="size-5 shrink-0 mt-0.5" /> |
| 30 | <div className="flex-1 min-w-0"> |
| 31 | <div className="flex items-center gap-2"> |
| 32 | <span className="font-medium text-sm">{tool.name}</span> |
| 33 | </div> |
| 34 | <p className="text-xs text-muted-foreground mt-0.5 line-clamp-2"> |
| 35 | {tool.description} |
| 36 | </p> |
| 37 | </div> |
| 38 | </Link> |
| 39 | ); |
| 40 | })} |
| 41 | </nav> |
| 42 | </div> |
| 43 | </aside> |
| 44 | ); |
| 45 | } |