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