Download src/components/SortToggle.tsx from hugging-science/science-release-map: direct link, hf CLI and curl.
- Browser
- Download file 1.27 kB
-
https://huggingface.co/spaces/hugging-science/science-release-map/resolve/main/src/components/SortToggle.tsx
- Command line
-
hf download hf://spaces/hugging-science/science-release-map/src/components/SortToggle.tsx
-
curl -L -o SortToggle.tsx https://huggingface.co/spaces/hugging-science/science-release-map/resolve/main/src/components/SortToggle.tsx
1.27 kB
| import React from "react"; | |
| export type SortMethod = "activity" | "recent"; | |
| interface SortToggleProps { | |
| sortMethod: SortMethod; | |
| onToggle: (method: SortMethod) => void; | |
| } | |
| export default function SortToggle({ sortMethod, onToggle }: SortToggleProps) { | |
| return ( | |
| <div className="flex items-center justify-center gap-2 mb-8"> | |
| <span className="text-sm text-muted-foreground">Sort by:</span> | |
| <div className="inline-flex rounded-lg border border-border bg-muted p-1"> | |
| <button | |
| onClick={() => onToggle("activity")} | |
| className={`px-4 py-2 text-sm font-medium rounded-md transition-all duration-200 ${ | |
| sortMethod === "activity" | |
| ? "bg-background text-foreground shadow-sm" | |
| : "text-muted-foreground hover:text-foreground" | |
| }`} | |
| > | |
| Most Active | |
| </button> | |
| <button | |
| onClick={() => onToggle("recent")} | |
| className={`px-4 py-2 text-sm font-medium rounded-md transition-all duration-200 ${ | |
| sortMethod === "recent" | |
| ? "bg-background text-foreground shadow-sm" | |
| : "text-muted-foreground hover:text-foreground" | |
| }`} | |
| > | |
| Most Recent | |
| </button> | |
| </div> | |
| </div> | |
| ); | |
| } | |