import { LayoutList, LayoutGrid } from 'lucide-react'; import * as React from 'react'; import { usePreferencesStore } from '@/lib/preferences-store'; import { cn } from '@/lib/utils'; export interface DensityToggleProps extends React.ButtonHTMLAttributes { /** Override label aria-label */ label?: string; } /** * DensityToggle — nút chuyển đổi giữa chế độ compact / regular. * Trạng thái lưu vào `usePreferencesStore`. */ export function DensityToggle({ label, className, ...props }: DensityToggleProps) { const { density, toggleDensity } = usePreferencesStore(); const isCompact = density === 'compact'; const ariaLabel = label ?? (isCompact ? 'Chuyển sang chế độ thường' : 'Chuyển sang chế độ compact'); return ( ); }