mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 09:09:36 +02:00
* feat: integrate main layout, toolbar, and rail from redesign into main ide-react folder * feat: remove additional files no longer used after ide redesign GitOrigin-RevId: 8fd77f63cb9c67be91995a9dde13b0fe2376d80f
49 lines
1.2 KiB
TypeScript
49 lines
1.2 KiB
TypeScript
import { useTranslation } from 'react-i18next'
|
|
import { useRailContext } from '@/features/ide-react/context/rail-context'
|
|
import OLIconButton from '@/shared/components/ol/ol-icon-button'
|
|
import React, { useCallback } from 'react'
|
|
import OLTooltip from '@/shared/components/ol/ol-tooltip'
|
|
|
|
export default function RailPanelHeader({
|
|
title,
|
|
actions,
|
|
onClose,
|
|
}: {
|
|
title: React.ReactNode
|
|
actions?: React.ReactElement
|
|
onClose?: () => void
|
|
}) {
|
|
const { t } = useTranslation()
|
|
const { handlePaneCollapse } = useRailContext()
|
|
|
|
const handleClose = useCallback(() => {
|
|
handlePaneCollapse()
|
|
if (onClose) {
|
|
onClose()
|
|
}
|
|
}, [handlePaneCollapse, onClose])
|
|
|
|
return (
|
|
<div className="rail-panel-header">
|
|
<h4 className="rail-panel-title">{title}</h4>
|
|
|
|
<div className="rail-panel-header-actions">
|
|
{actions}
|
|
<OLTooltip
|
|
id="close-rail-panel"
|
|
description={t('close')}
|
|
overlayProps={{ placement: 'bottom' }}
|
|
>
|
|
<OLIconButton
|
|
onClick={handleClose}
|
|
className="rail-panel-header-button-subdued"
|
|
icon="close"
|
|
accessibilityLabel={t('close')}
|
|
size="sm"
|
|
/>
|
|
</OLTooltip>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|