panel-heading.tsx 964 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. title: string
  7. splitTestName?: string
  8. children?: React.ReactNode
  9. handleClose(): void
  10. }> = ({ title, splitTestName, children, handleClose }) => {
  11. const { t } = useTranslation()
  12. return (
  13. <div className="panel-heading">
  14. <div className="panel-heading-label">
  15. <span>{title}</span>
  16. {splitTestName && (
  17. <SplitTestBadge
  18. splitTestName={splitTestName}
  19. displayOnVariants={['enabled']}
  20. />
  21. )}
  22. </div>
  23. {children}
  24. <button
  25. type="button"
  26. className="btn panel-heading-close-button"
  27. aria-label={t('close')}
  28. onClick={handleClose}
  29. >
  30. <MaterialIcon type="close" />
  31. </button>
  32. </div>
  33. )
  34. }