pdf-log-entry-content.jsx 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import { useTranslation } from 'react-i18next'
  2. import PdfLogEntryRawContent from './pdf-log-entry-raw-content'
  3. import PropTypes from 'prop-types'
  4. import importOverleafModules from '../../../../macros/import-overleaf-module.macro'
  5. const pdfLogEntryComponents = importOverleafModules('pdfLogEntryComponents')
  6. export default function PdfLogEntryContent({
  7. rawContent,
  8. formattedContent,
  9. extraInfoURL,
  10. index,
  11. logEntry,
  12. }) {
  13. const { t } = useTranslation()
  14. return (
  15. <div className="log-entry-content">
  16. {formattedContent && (
  17. <div className="log-entry-formatted-content">{formattedContent}</div>
  18. )}
  19. {extraInfoURL && (
  20. <div className="log-entry-content-link">
  21. <a href={extraInfoURL} target="_blank" rel="noopener">
  22. {t('log_hint_extra_info')}
  23. </a>
  24. </div>
  25. )}
  26. {logEntry &&
  27. pdfLogEntryComponents.map(
  28. ({ import: { default: Component }, path }) => (
  29. <Component key={path} index={index} logEntry={logEntry} />
  30. )
  31. )}
  32. {rawContent && (
  33. <PdfLogEntryRawContent rawContent={rawContent} collapsedSize={150} />
  34. )}
  35. </div>
  36. )
  37. }
  38. PdfLogEntryContent.propTypes = {
  39. rawContent: PropTypes.string,
  40. formattedContent: PropTypes.node,
  41. extraInfoURL: PropTypes.string,
  42. index: PropTypes.number,
  43. logEntry: PropTypes.any,
  44. }