import React, { useEffect } from 'react' import PropTypes from 'prop-types' import classNames from 'classnames' import { useTranslation } from 'react-i18next' import OutlineRoot from './outline-root' import Icon from '../../../shared/components/icon' import withErrorBoundary from '../../../infrastructure/error-boundary' import Tooltip from '../../../shared/components/tooltip' const OutlinePane = React.memo(function OutlinePane({ isTexFile, outline, jumpToLine, onToggle, highlightedLine, isPartial = false, expanded, toggleExpanded, }) { const { t } = useTranslation() const isOpen = isTexFile && expanded useEffect(() => { onToggle(isOpen) }, [isOpen, onToggle]) const headerClasses = classNames('outline-pane', { 'outline-pane-disabled': !isTexFile, }) return (
{isOpen && (
)}
) }) OutlinePane.propTypes = { isTexFile: PropTypes.bool.isRequired, outline: PropTypes.array.isRequired, jumpToLine: PropTypes.func.isRequired, onToggle: PropTypes.func.isRequired, highlightedLine: PropTypes.number, isPartial: PropTypes.bool, expanded: PropTypes.bool, toggleExpanded: PropTypes.func.isRequired, } export default withErrorBoundary(OutlinePane)