mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-25 18:20:09 +02:00
Align rail panel headers to use the same font-weight and line-height GitOrigin-RevId: e982f6d816e2f1b0e8f4a0af603222262d58bab0
48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
import { FC } from 'react'
|
|
import SplitTestBadge from '@/shared/components/split-test-badge'
|
|
import MaterialIcon from '@/shared/components/material-icon'
|
|
import { useTranslation } from 'react-i18next'
|
|
import OLTooltip from '@/shared/components/ol/ol-tooltip'
|
|
|
|
// TODO ide-redesign-cleanup: Remove this component and only use RailPanelHeader
|
|
export const PanelHeading: FC<
|
|
React.PropsWithChildren<{
|
|
title: string
|
|
splitTestName?: string
|
|
children?: React.ReactNode
|
|
handleClose(): void
|
|
}>
|
|
> = ({ title, splitTestName, children, handleClose }) => {
|
|
const { t } = useTranslation()
|
|
|
|
return (
|
|
<div className="panel-heading">
|
|
<div className="panel-heading-label">
|
|
<span>{title}</span>
|
|
{splitTestName && (
|
|
<SplitTestBadge
|
|
splitTestName={splitTestName}
|
|
displayOnVariants={['enabled']}
|
|
/>
|
|
)}
|
|
</div>
|
|
|
|
{children}
|
|
<OLTooltip
|
|
id="close-panel"
|
|
description={t('close')}
|
|
overlayProps={{ placement: 'bottom' }}
|
|
>
|
|
<button
|
|
type="button"
|
|
className="btn panel-heading-close-button"
|
|
aria-label={t('close')}
|
|
onClick={handleClose}
|
|
>
|
|
<MaterialIcon type="close" />
|
|
</button>
|
|
</OLTooltip>
|
|
</div>
|
|
)
|
|
}
|