* Improve dashboard responsive layouts * Improve proxy pools mobile layout * Improve CLI tool card input responsiveness --------- Co-authored-by: Delynn Assistant <zhen@dkzhen.org>
48 lines
1.1 KiB
JavaScript
48 lines
1.1 KiB
JavaScript
"use client";
|
|
|
|
import { cn } from "@/shared/utils/cn";
|
|
|
|
export default function SegmentedControl({
|
|
options = [],
|
|
value,
|
|
onChange,
|
|
size = "md",
|
|
className,
|
|
}) {
|
|
const sizes = {
|
|
sm: "h-7 text-xs",
|
|
md: "h-9 text-sm",
|
|
lg: "h-11 text-base",
|
|
};
|
|
|
|
return (
|
|
<div
|
|
className={cn(
|
|
"inline-flex items-center p-1 rounded-lg overflow-x-auto",
|
|
"bg-black/5 dark:bg-white/5",
|
|
className
|
|
)}
|
|
>
|
|
{options.map((option) => (
|
|
<button
|
|
key={option.value}
|
|
onClick={() => onChange(option.value)}
|
|
className={cn(
|
|
"shrink-0 px-4 rounded-md font-medium transition-all",
|
|
sizes[size],
|
|
value === option.value
|
|
? "bg-white dark:bg-white/10 text-text-main shadow-sm"
|
|
: "text-text-muted hover:text-text-main"
|
|
)}
|
|
>
|
|
{option.icon && (
|
|
<span className="material-symbols-outlined text-[16px] mr-1.5">
|
|
{option.icon}
|
|
</span>
|
|
)}
|
|
{option.label}
|
|
</button>
|
|
))}
|
|
</div>
|
|
);
|
|
}
|