overleaf/services/web/frontend/js/features/pdf-preview/components/pdf-log-entry-content.js
Alf Eaton 12eab99990 Migrate log entry component to new PDF preview (#5478)
* Migrate log entry component to new PDF preview
* Add a test for expandable log content

GitOrigin-RevId: 3e2154983c1ea03b5db44c87822e7043c4aa2cfe
2021-10-18 08:03:30 +00:00

37 lines
932 B
JavaScript

import { useTranslation } from 'react-i18next'
import PdfLogEntryRawContent from './pdf-log-entry-raw-content'
import PropTypes from 'prop-types'
export default function PdfLogEntryContent({
rawContent,
formattedContent,
extraInfoURL,
}) {
const { t } = useTranslation()
return (
<div className="log-entry-content">
{formattedContent && (
<div className="log-entry-formatted-content">{formattedContent}</div>
)}
{extraInfoURL && (
<div className="log-entry-content-link">
<a href={extraInfoURL} target="_blank" rel="noopener">
{t('log_hint_extra_info')}
</a>
</div>
)}
{rawContent && (
<PdfLogEntryRawContent rawContent={rawContent} collapsedSize={150} />
)}
</div>
)
}
PdfLogEntryContent.propTypes = {
rawContent: PropTypes.string,
formattedContent: PropTypes.node,
extraInfoURL: PropTypes.string,
}