import type { ReactNode } from 'react'

type Props = {
  label: string
  onClick?: () => void
  disabled?: boolean
  children: ReactNode
  className?: string
}

export function IconButton({ label, onClick, disabled, children, className = '' }: Props) {
  return (
    <span className={`icon-btn-wrap ${className}`.trim()}>
      <button
        type="button"
        className="icon-btn"
        aria-label={label}
        title={label}
        onClick={onClick}
        disabled={disabled}
      >
        {children}
      </button>
      <span className="icon-btn-tooltip" role="tooltip">
        {label}
      </span>
    </span>
  )
}
