close.tsx 901 B

12345678910111213141516171819202122232425262728293031323334
  1. import { useTranslation } from 'react-i18next'
  2. import MaterialIcon from '@/shared/components/material-icon'
  3. import BootstrapVersionSwitcher from '@/features/ui/components/bootstrap-5/bootstrap-version-switcher'
  4. type CloseProps = {
  5. onDismiss: React.MouseEventHandler<HTMLButtonElement>
  6. variant?: 'light' | 'dark'
  7. }
  8. function Close({ onDismiss, variant = 'light' }: CloseProps) {
  9. const { t } = useTranslation()
  10. return (
  11. <button
  12. type="button"
  13. className={`close pull-right ${variant}`}
  14. onClick={onDismiss}
  15. >
  16. <BootstrapVersionSwitcher
  17. bs3={<span aria-hidden="true">&times;</span>}
  18. bs5={
  19. <MaterialIcon
  20. type="close"
  21. className="align-text-bottom"
  22. accessibilityLabel={t('close')}
  23. />
  24. }
  25. />
  26. <span className="sr-only">{t('close')}</span>
  27. </button>
  28. )
  29. }
  30. export default Close