2020-06-29 13:05:08 +00:00
|
|
|
import PropTypes from 'prop-types'
|
2020-09-03 09:23:34 +00:00
|
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
|
2020-09-01 08:09:04 +00:00
|
|
|
import OutlineList from './outline-list'
|
2020-06-29 13:05:08 +00:00
|
|
|
|
2020-07-28 09:37:46 +00:00
|
|
|
function OutlineRoot({ outline, jumpToLine, highlightedLine }) {
|
2020-09-03 09:23:34 +00:00
|
|
|
const { t } = useTranslation()
|
|
|
|
|
2020-06-29 13:05:08 +00:00
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
{outline.length ? (
|
2020-07-28 09:37:46 +00:00
|
|
|
<OutlineList
|
|
|
|
outline={outline}
|
|
|
|
jumpToLine={jumpToLine}
|
|
|
|
isRoot
|
|
|
|
highlightedLine={highlightedLine}
|
|
|
|
/>
|
2020-06-29 13:05:08 +00:00
|
|
|
) : (
|
|
|
|
<div className="outline-body-no-elements">
|
2020-09-03 09:23:34 +00:00
|
|
|
{t('we_cant_find_any_sections_or_subsections_in_this_file')}.{' '}
|
2020-06-29 13:05:08 +00:00
|
|
|
<a
|
|
|
|
href="/learn/how-to/Using_the_File_Outline_feature"
|
|
|
|
className="outline-body-link"
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
>
|
2020-09-03 09:23:34 +00:00
|
|
|
{t('find_out_more_about_the_file_outline')}
|
2020-06-29 13:05:08 +00:00
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
OutlineRoot.propTypes = {
|
|
|
|
outline: PropTypes.array.isRequired,
|
2020-07-28 09:37:46 +00:00
|
|
|
jumpToLine: PropTypes.func.isRequired,
|
2021-04-27 07:52:58 +00:00
|
|
|
highlightedLine: PropTypes.number,
|
2020-06-29 13:05:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export default OutlineRoot
|