OutlineRoot.js 976 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import React from 'react'
  2. import PropTypes from 'prop-types'
  3. import OutlineList from './OutlineList'
  4. function OutlineRoot({ outline, jumpToLine, highlightedLine }) {
  5. return (
  6. <div>
  7. {outline.length ? (
  8. <OutlineList
  9. outline={outline}
  10. jumpToLine={jumpToLine}
  11. isRoot
  12. highlightedLine={highlightedLine}
  13. />
  14. ) : (
  15. <div className="outline-body-no-elements">
  16. We can’t find any sections or subsections in this file.{' '}
  17. <a
  18. href="/learn/how-to/Using_the_File_Outline_feature"
  19. className="outline-body-link"
  20. target="_blank"
  21. rel="noopener noreferrer"
  22. >
  23. Know more about the file outline
  24. </a>
  25. </div>
  26. )}
  27. </div>
  28. )
  29. }
  30. OutlineRoot.propTypes = {
  31. outline: PropTypes.array.isRequired,
  32. jumpToLine: PropTypes.func.isRequired,
  33. highlightedLine: PropTypes.number
  34. }
  35. export default OutlineRoot