2024-09-03 07:30:25 -04:00
|
|
|
import OLTooltip from '@/features/ui/components/ol/ol-tooltip'
|
|
|
|
import MaterialIcon from '@/shared/components/material-icon'
|
2024-02-01 04:41:12 -05:00
|
|
|
import React, { memo } from 'react'
|
|
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
|
|
|
|
export const OutlineToggleButton = memo<{
|
|
|
|
isTexFile: boolean
|
|
|
|
toggleExpanded: () => void
|
|
|
|
expanded?: boolean
|
|
|
|
isOpen: boolean
|
|
|
|
isPartial: boolean
|
|
|
|
}>(({ isTexFile, toggleExpanded, expanded, isOpen, isPartial }) => {
|
|
|
|
const { t } = useTranslation()
|
|
|
|
|
|
|
|
return (
|
|
|
|
<button
|
|
|
|
className="outline-header-expand-collapse-btn"
|
|
|
|
disabled={!isTexFile}
|
|
|
|
onClick={toggleExpanded}
|
|
|
|
aria-label={expanded ? t('hide_outline') : t('show_outline')}
|
|
|
|
>
|
2024-09-03 07:30:25 -04:00
|
|
|
<MaterialIcon
|
|
|
|
type={isOpen ? 'keyboard_arrow_down' : 'keyboard_arrow_right'}
|
2024-02-01 04:41:12 -05:00
|
|
|
className="outline-caret-icon"
|
|
|
|
/>
|
|
|
|
<h4 className="outline-header-name">{t('file_outline')}</h4>
|
|
|
|
{isPartial && (
|
2024-09-03 07:30:25 -04:00
|
|
|
<OLTooltip
|
2024-02-01 04:41:12 -05:00
|
|
|
id="partial-outline"
|
|
|
|
description={t('partial_outline_warning')}
|
|
|
|
overlayProps={{ placement: 'top' }}
|
|
|
|
>
|
2024-09-03 07:30:25 -04:00
|
|
|
<span role="status" style={{ display: 'flex' }}>
|
|
|
|
<MaterialIcon
|
|
|
|
type="warning"
|
|
|
|
accessibilityLabel={t('partial_outline_warning')}
|
2024-02-01 04:41:12 -05:00
|
|
|
/>
|
|
|
|
</span>
|
2024-09-03 07:30:25 -04:00
|
|
|
</OLTooltip>
|
2024-02-01 04:41:12 -05:00
|
|
|
)}
|
|
|
|
</button>
|
|
|
|
)
|
|
|
|
})
|
|
|
|
OutlineToggleButton.displayName = 'OutlineToggleButton'
|