panel-heading.tsx 1003 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import { FC } from 'react'
  2. import SplitTestBadge from '@/shared/components/split-test-badge'
  3. import MaterialIcon from '@/shared/components/material-icon'
  4. import { useTranslation } from 'react-i18next'
  5. export const PanelHeading: FC<
  6. React.PropsWithChildren<{
  7. title: string
  8. splitTestName?: string
  9. children?: React.ReactNode
  10. handleClose(): void
  11. }>
  12. > = ({ title, splitTestName, children, handleClose }) => {
  13. const { t } = useTranslation()
  14. return (
  15. <div className="panel-heading">
  16. <div className="panel-heading-label">
  17. <span>{title}</span>
  18. {splitTestName && (
  19. <SplitTestBadge
  20. splitTestName={splitTestName}
  21. displayOnVariants={['enabled']}
  22. />
  23. )}
  24. </div>
  25. {children}
  26. <button
  27. type="button"
  28. className="btn panel-heading-close-button"
  29. aria-label={t('close')}
  30. onClick={handleClose}
  31. >
  32. <MaterialIcon type="close" />
  33. </button>
  34. </div>
  35. )
  36. }