File size: 1,269 Bytes
0b13486 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
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>
);
}
|