outline-root.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import PropTypes from 'prop-types'
  2. import { useTranslation } from 'react-i18next'
  3. import OutlineList from './outline-list'
  4. function OutlineRoot({ outline, jumpToLine, highlightedLine }) {
  5. const { t } = useTranslation()
  6. return (
  7. <div>
  8. {outline.length ? (
  9. <OutlineList
  10. outline={outline}
  11. jumpToLine={jumpToLine}
  12. isRoot
  13. highlightedLine={highlightedLine}
  14. />
  15. ) : (
  16. <div className="outline-body-no-elements">
  17. {t('we_cant_find_any_sections_or_subsections_in_this_file')}.{' '}
  18. <a
  19. href="/learn/how-to/Using_the_File_Outline_feature"
  20. className="outline-body-link"
  21. target="_blank"
  22. rel="noopener noreferrer"
  23. >
  24. {t('find_out_more_about_the_file_outline')}
  25. </a>
  26. </div>
  27. )}
  28. </div>
  29. )
  30. }
  31. OutlineRoot.propTypes = {
  32. outline: PropTypes.array.isRequired,
  33. jumpToLine: PropTypes.func.isRequired,
  34. highlightedLine: PropTypes.number,
  35. }
  36. export default OutlineRoot