mirror of
https://github.com/jhd3197/ServerKit.git
synced 2026-12-02 05:05:12 +09:00
Per docs/plans/FRONTEND_UX_TAILWIND_CLEANUP_PLAN.md §8.5. React 18's automatic JSX runtime makes 'import React' unnecessary; removed it from the 142 files eslint flagged as 'React defined but never used' (named imports like useState preserved). Driven by an eslint --format json pass so only flagged files were touched. Lint warnings: 1603 -> 1461 (0 errors). Verified: npm run build passes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
39 lines
883 B
React
39 lines
883 B
React
import { Button } from '@/components/ui/button';
|
|
import { cn } from '@/lib/utils';
|
|
|
|
/**
|
|
* Accessible icon-only button. Always provide a descriptive label; it is used
|
|
* for the aria-label and optional title.
|
|
*
|
|
* <IconButton icon={<RefreshCw size={16} />} label="Refresh" onClick={load} />
|
|
*/
|
|
export function IconButton({
|
|
icon,
|
|
label,
|
|
onClick,
|
|
variant = 'ghost',
|
|
size = 'sm',
|
|
className,
|
|
title,
|
|
disabled,
|
|
...props
|
|
}) {
|
|
return (
|
|
<Button
|
|
type="button"
|
|
variant={variant}
|
|
size="icon"
|
|
className={cn('icon-button', size === 'sm' && 'btn-sm', className)}
|
|
onClick={onClick}
|
|
disabled={disabled}
|
|
aria-label={label}
|
|
title={title || label}
|
|
{...props}
|
|
>
|
|
{icon}
|
|
</Button>
|
|
);
|
|
}
|
|
|
|
export default IconButton;
|