|
@@ -1,18 +1,28 @@
|
|
|
import { useTranslation } from 'react-i18next'
|
|
import { useTranslation } from 'react-i18next'
|
|
|
import { useRailContext } from '../../contexts/rail-context'
|
|
import { useRailContext } from '../../contexts/rail-context'
|
|
|
import OLIconButton from '@/shared/components/ol/ol-icon-button'
|
|
import OLIconButton from '@/shared/components/ol/ol-icon-button'
|
|
|
-import React from 'react'
|
|
|
|
|
|
|
+import React, { useCallback } from 'react'
|
|
|
import OLTooltip from '@/shared/components/ol/ol-tooltip'
|
|
import OLTooltip from '@/shared/components/ol/ol-tooltip'
|
|
|
|
|
|
|
|
export default function RailPanelHeader({
|
|
export default function RailPanelHeader({
|
|
|
title,
|
|
title,
|
|
|
actions,
|
|
actions,
|
|
|
|
|
+ onClose,
|
|
|
}: {
|
|
}: {
|
|
|
title: React.ReactNode
|
|
title: React.ReactNode
|
|
|
actions?: React.ReactNode[]
|
|
actions?: React.ReactNode[]
|
|
|
|
|
+ onClose?: () => void
|
|
|
}) {
|
|
}) {
|
|
|
const { t } = useTranslation()
|
|
const { t } = useTranslation()
|
|
|
const { handlePaneCollapse } = useRailContext()
|
|
const { handlePaneCollapse } = useRailContext()
|
|
|
|
|
+
|
|
|
|
|
+ const handleClose = useCallback(() => {
|
|
|
|
|
+ handlePaneCollapse()
|
|
|
|
|
+ if (onClose) {
|
|
|
|
|
+ onClose()
|
|
|
|
|
+ }
|
|
|
|
|
+ }, [handlePaneCollapse, onClose])
|
|
|
|
|
+
|
|
|
return (
|
|
return (
|
|
|
<div className="rail-panel-header">
|
|
<div className="rail-panel-header">
|
|
|
<h4 className="rail-panel-title">{title}</h4>
|
|
<h4 className="rail-panel-title">{title}</h4>
|
|
@@ -25,7 +35,7 @@ export default function RailPanelHeader({
|
|
|
overlayProps={{ placement: 'bottom' }}
|
|
overlayProps={{ placement: 'bottom' }}
|
|
|
>
|
|
>
|
|
|
<OLIconButton
|
|
<OLIconButton
|
|
|
- onClick={handlePaneCollapse}
|
|
|
|
|
|
|
+ onClick={handleClose}
|
|
|
className="rail-panel-header-button-subdued"
|
|
className="rail-panel-header-button-subdued"
|
|
|
icon="close"
|
|
icon="close"
|
|
|
accessibilityLabel={t('close')}
|
|
accessibilityLabel={t('close')}
|