preview-logs-pane-entry.stories.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. import PreviewLogsPaneEntry from '../js/features/preview/components/preview-logs-pane-entry.js'
  2. import Icon from '../js/shared/components/icon.js'
  3. export const EntryWithCompilerOutput = args => (
  4. <PreviewLogsPaneEntry {...args} />
  5. )
  6. EntryWithCompilerOutput.args = {
  7. title: 'PreviewLogsPaneEntry/bar/baz',
  8. level: 'error',
  9. }
  10. export const EntryWithCompilerOutputAndHumanReadableHint = args => (
  11. <PreviewLogsPaneEntry {...args} />
  12. )
  13. EntryWithCompilerOutputAndHumanReadableHint.args = {
  14. level: 'error',
  15. formattedContent: <SampleHumanReadableHintComponent />,
  16. extraInfoURL:
  17. 'https://www.overleaf.com/learn/latex/Errors/Extra_alignment_tab_has_been_changed_to_%5Ccr',
  18. }
  19. export const EntryWithoutCompilerOutput = args => (
  20. <PreviewLogsPaneEntry {...args} />
  21. )
  22. EntryWithoutCompilerOutput.args = {
  23. level: 'error',
  24. rawContent: null,
  25. }
  26. export const EntryWithoutSourceLocationLink = args => (
  27. <PreviewLogsPaneEntry {...args} />
  28. )
  29. EntryWithoutSourceLocationLink.args = {
  30. level: 'error',
  31. showSourceLocationLink: false,
  32. }
  33. export const EntryWithLevelError = args => <PreviewLogsPaneEntry {...args} />
  34. EntryWithLevelError.args = {
  35. level: 'error',
  36. }
  37. export const EntryWithLevelWarning = args => <PreviewLogsPaneEntry {...args} />
  38. EntryWithLevelWarning.args = {
  39. level: 'warning',
  40. }
  41. export const EntryWithLevelTypesetting = args => (
  42. <PreviewLogsPaneEntry {...args} />
  43. )
  44. EntryWithLevelTypesetting.args = {
  45. level: 'typesetting',
  46. }
  47. export const EntryWithLevelRaw = args => <PreviewLogsPaneEntry {...args} />
  48. EntryWithLevelRaw.args = {
  49. level: 'raw',
  50. }
  51. export const EntryWithLevelSuccess = args => <PreviewLogsPaneEntry {...args} />
  52. EntryWithLevelSuccess.args = {
  53. level: 'success',
  54. }
  55. export const EntryWithButtonToClose = args => <PreviewLogsPaneEntry {...args} />
  56. EntryWithButtonToClose.args = {
  57. level: 'error',
  58. showCloseButton: true,
  59. onClose: () => window.alert('You clicked "×"'),
  60. }
  61. export const EntryWithIcon = args => <PreviewLogsPaneEntry {...args} />
  62. EntryWithIcon.args = {
  63. level: 'error',
  64. headerIcon: <Icon type="taxi" />,
  65. }
  66. export const EntryWithBetaIcon = args => <PreviewLogsPaneEntry {...args} />
  67. EntryWithBetaIcon.args = {
  68. level: 'typesetting',
  69. headerIcon: <span className="beta-badge" />,
  70. }
  71. function SampleHumanReadableHintComponent() {
  72. return (
  73. <>
  74. Human-readable hint to help LaTeX newbies. Supports <b>mark-up</b> for
  75. e.g.{' '}
  76. <a
  77. target="_blank"
  78. rel="noopener noreferrer"
  79. href="https://www.overleaf.com/learn/latex/Errors/Extra_alignment_tab_has_been_changed_to_%5Ccr"
  80. >
  81. inline links
  82. </a>
  83. .
  84. </>
  85. )
  86. }
  87. export default {
  88. title: 'Preview Logs / Entry',
  89. component: PreviewLogsPaneEntry,
  90. args: {
  91. sourceLocation: {
  92. file: 'foo/bar.tex',
  93. line: 10,
  94. column: 20,
  95. },
  96. headerTitle: 'Entry title',
  97. rawContent: `
  98. The LaTeX compiler output
  99. * With a lot of details
  100. Wrapped in an HTML <pre> element with
  101. preformatted text which is to be presented exactly
  102. as written in the HTML file
  103. (whitespace included™)
  104. The text is typically rendered using a non-proportional ("monospace") font.
  105. LaTeX Font Info: External font \`cmex10' loaded for size
  106. (Font) <7> on input line 18.
  107. LaTeX Font Info: External font \`cmex10' loaded for size
  108. (Font) <5> on input line 18.
  109. ! Undefined control sequence.
  110. <recently read> \\Zlpha
  111. main.tex, line 23
  112. `,
  113. },
  114. }