2020-11-05 10:22:05 +00:00
|
|
|
|
import React from 'react'
|
2020-11-26 09:58:42 +00:00
|
|
|
|
import PreviewLogsPaneEntry from '../js/features/preview/components/preview-logs-pane-entry.js'
|
2021-01-21 12:21:22 +00:00
|
|
|
|
import Icon from '../js/shared/components/icon.js'
|
2020-11-05 10:22:05 +00:00
|
|
|
|
|
2021-01-21 12:21:22 +00:00
|
|
|
|
export const EntryWithCompilerOutput = args => (
|
2020-11-26 09:58:42 +00:00
|
|
|
|
<PreviewLogsPaneEntry {...args} />
|
|
|
|
|
)
|
2021-01-21 12:21:22 +00:00
|
|
|
|
EntryWithCompilerOutput.args = {
|
|
|
|
|
title: 'PreviewLogsPaneEntry/bar/baz',
|
2020-11-05 10:22:05 +00:00
|
|
|
|
level: 'error'
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-21 12:21:22 +00:00
|
|
|
|
export const EntryWithCompilerOutputAndHumanReadableHint = args => (
|
2020-11-26 09:58:42 +00:00
|
|
|
|
<PreviewLogsPaneEntry {...args} />
|
2020-11-05 10:22:05 +00:00
|
|
|
|
)
|
2021-01-21 12:21:22 +00:00
|
|
|
|
EntryWithCompilerOutputAndHumanReadableHint.args = {
|
2020-11-05 10:22:05 +00:00
|
|
|
|
level: 'error',
|
2020-11-26 09:58:42 +00:00
|
|
|
|
formattedContent: <SampleHumanReadableHintComponent />,
|
2020-11-05 10:22:05 +00:00
|
|
|
|
extraInfoURL:
|
|
|
|
|
'https://www.overleaf.com/learn/latex/Errors/Extra_alignment_tab_has_been_changed_to_%5Ccr'
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-21 12:21:22 +00:00
|
|
|
|
export const EntryWithoutCompilerOutput = args => (
|
2020-11-26 09:58:42 +00:00
|
|
|
|
<PreviewLogsPaneEntry {...args} />
|
|
|
|
|
)
|
2021-01-21 12:21:22 +00:00
|
|
|
|
EntryWithoutCompilerOutput.args = {
|
2020-11-05 10:22:05 +00:00
|
|
|
|
level: 'error',
|
2020-11-26 09:58:42 +00:00
|
|
|
|
rawContent: null
|
2020-11-05 10:22:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-01-21 12:21:22 +00:00
|
|
|
|
export const EntryWithoutSourceLocationLink = args => (
|
2020-11-26 09:58:42 +00:00
|
|
|
|
<PreviewLogsPaneEntry {...args} />
|
|
|
|
|
)
|
2021-01-21 12:21:22 +00:00
|
|
|
|
EntryWithoutSourceLocationLink.args = {
|
|
|
|
|
level: 'error',
|
|
|
|
|
showSourceLocationLink: false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const EntryWithLevelError = args => <PreviewLogsPaneEntry {...args} />
|
|
|
|
|
EntryWithLevelError.args = {
|
|
|
|
|
level: 'error'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const EntryWithLevelWarning = args => <PreviewLogsPaneEntry {...args} />
|
|
|
|
|
EntryWithLevelWarning.args = {
|
2020-11-05 10:22:05 +00:00
|
|
|
|
level: 'warning'
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-21 12:21:22 +00:00
|
|
|
|
export const EntryWithLevelTypesetting = args => (
|
2020-11-26 09:58:42 +00:00
|
|
|
|
<PreviewLogsPaneEntry {...args} />
|
2020-11-05 10:22:05 +00:00
|
|
|
|
)
|
2021-01-21 12:21:22 +00:00
|
|
|
|
EntryWithLevelTypesetting.args = {
|
|
|
|
|
level: 'typesetting'
|
2020-11-05 10:22:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-01-21 12:21:22 +00:00
|
|
|
|
export const EntryWithLevelRaw = args => <PreviewLogsPaneEntry {...args} />
|
|
|
|
|
EntryWithLevelRaw.args = {
|
|
|
|
|
level: 'raw'
|
2020-11-05 10:22:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-01-21 12:21:22 +00:00
|
|
|
|
export const EntryWithLevelSuccess = args => <PreviewLogsPaneEntry {...args} />
|
|
|
|
|
EntryWithLevelSuccess.args = {
|
|
|
|
|
level: 'success'
|
2020-11-05 10:22:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-01-21 12:21:22 +00:00
|
|
|
|
export const EntryWithButtonToClose = args => <PreviewLogsPaneEntry {...args} />
|
|
|
|
|
EntryWithButtonToClose.args = {
|
|
|
|
|
level: 'error',
|
|
|
|
|
showCloseButton: true,
|
|
|
|
|
onClose: () => window.alert('You clicked "×"')
|
2020-11-05 10:22:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-01-21 12:21:22 +00:00
|
|
|
|
export const EntryWithIcon = args => <PreviewLogsPaneEntry {...args} />
|
|
|
|
|
EntryWithIcon.args = {
|
|
|
|
|
level: 'error',
|
|
|
|
|
headerIcon: <Icon type="taxi" />
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const EntryWithBetaIcon = args => <PreviewLogsPaneEntry {...args} />
|
|
|
|
|
EntryWithBetaIcon.args = {
|
2020-11-05 10:22:05 +00:00
|
|
|
|
level: 'typesetting',
|
2021-01-21 12:21:22 +00:00
|
|
|
|
headerIcon: <span className="beta-badge" />
|
2020-11-05 10:22:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function SampleHumanReadableHintComponent() {
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
Human-readable hint to help LaTeX newbies. Supports <b>mark-up</b> for
|
|
|
|
|
e.g.{' '}
|
|
|
|
|
<a
|
|
|
|
|
target="_blank"
|
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
|
href="https://www.overleaf.com/learn/latex/Errors/Extra_alignment_tab_has_been_changed_to_%5Ccr"
|
|
|
|
|
>
|
|
|
|
|
inline links
|
|
|
|
|
</a>
|
|
|
|
|
.
|
|
|
|
|
</>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default {
|
2020-11-26 09:58:42 +00:00
|
|
|
|
title: 'PreviewLogsPaneEntry',
|
|
|
|
|
component: PreviewLogsPaneEntry,
|
2020-11-05 10:22:05 +00:00
|
|
|
|
args: {
|
2020-11-26 09:58:42 +00:00
|
|
|
|
sourceLocation: {
|
|
|
|
|
file: 'foo/bar.tex',
|
|
|
|
|
line: 10,
|
|
|
|
|
column: 20
|
|
|
|
|
},
|
2021-01-21 12:21:22 +00:00
|
|
|
|
headerTitle: 'Entry title',
|
2020-11-26 09:58:42 +00:00
|
|
|
|
rawContent: `
|
2020-11-05 10:22:05 +00:00
|
|
|
|
The LaTeX compiler output
|
|
|
|
|
* With a lot of details
|
|
|
|
|
|
|
|
|
|
Wrapped in an HTML <pre> element with
|
|
|
|
|
preformatted text which is to be presented exactly
|
|
|
|
|
as written in the HTML file
|
|
|
|
|
|
|
|
|
|
(whitespace included™)
|
|
|
|
|
|
|
|
|
|
The text is typically rendered using a non-proportional ("monospace") font.
|
|
|
|
|
|
|
|
|
|
LaTeX Font Info: External font \`cmex10' loaded for size
|
|
|
|
|
(Font) <7> on input line 18.
|
|
|
|
|
LaTeX Font Info: External font \`cmex10' loaded for size
|
|
|
|
|
(Font) <5> on input line 18.
|
|
|
|
|
! Undefined control sequence.
|
|
|
|
|
<recently read> \\Zlpha
|
|
|
|
|
|
|
|
|
|
main.tex, line 23
|
|
|
|
|
|
|
|
|
|
`
|
|
|
|
|
}
|
|
|
|
|
}
|