import { Slider } from "@/components/ui/slider";
import { Maximize2, Minimize2 } from "lucide-react";

export type Density = "cozy" | "compact";

export function DensityToggle({
  value,
  onValueChange,
}: {
  value: Density;
  onValueChange: (d: Density) => void;
}) {
  return (
    <div className="flex items-center gap-2" title={`Density: ${value === "compact" ? "Compact" : "Comfortable"}`}>
      <Maximize2 className="w-4 h-4 text-muted-foreground" aria-hidden />
      <Slider
        className="w-16"
        min={0}
        max={1}
        step={1}
        value={[value === "compact" ? 1 : 0]}
        onValueChange={([v]) => onValueChange(v === 1 ? "compact" : "cozy")}
        aria-label="List density"
      />
      <Minimize2 className="w-4 h-4 text-muted-foreground" aria-hidden />
    </div>
  );
}
