feat(ui): add reusable IconButton component with square styling

This commit is contained in:
Gigi
2025-10-03 00:47:37 +02:00
parent 81a48bd0f6
commit f9d381e451
2 changed files with 60 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
import React from 'react'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import type { IconDefinition } from '@fortawesome/fontawesome-svg-core'
interface IconButtonProps {
icon: IconDefinition
onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void
title?: string
ariaLabel?: string
variant?: 'primary' | 'success' | 'ghost'
size?: number
}
const IconButton: React.FC<IconButtonProps> = ({
icon,
onClick,
title,
ariaLabel,
variant = 'ghost',
size = 28
}) => {
return (
<button
className={`icon-button ${variant}`}
onClick={onClick}
title={title}
aria-label={ariaLabel || title}
style={{ width: size, height: size }}
>
<FontAwesomeIcon icon={icon} />
</button>
)
}
export default IconButton