import type { ReactElement } from 'react';

interface AccessibleIconProps {
  icon: ReactElement;
  label?: string;
}

export function AccessibleIcon({ icon, label }: AccessibleIconProps) {
  if (label) {
    return (
      <span role="img" aria-label={label}>
        {icon}
      </span>
    );
  }
  return <span aria-hidden="true">{icon}</span>;
}
