close.tsx 659 B

12345678910111213141516171819202122232425262728
  1. import { useTranslation } from 'react-i18next'
  2. import MaterialIcon from '@/shared/components/material-icon'
  3. type CloseProps = {
  4. onDismiss: React.MouseEventHandler<HTMLButtonElement>
  5. variant?: 'light' | 'dark'
  6. }
  7. function Close({ onDismiss, variant = 'light' }: CloseProps) {
  8. const { t } = useTranslation()
  9. return (
  10. <button
  11. type="button"
  12. className={`close pull-right ${variant}`}
  13. onClick={onDismiss}
  14. >
  15. <MaterialIcon
  16. type="close"
  17. className="align-text-bottom"
  18. accessibilityLabel={t('close')}
  19. />
  20. <span className="sr-only">{t('close')}</span>
  21. </button>
  22. )
  23. }
  24. export default Close