overleaf/services/web/frontend/stories/preview-logs-pane.stories.js
Alf Eaton 7c97f8ab6e Switch to new JSX runtime (#4225)
* Use new JSX runtime and update Babel Node target
* Update .eslintrc
* Remove React imports

GitOrigin-RevId: 559de0267f8f2934c56a860ea8701bb522aa861a
2021-06-24 02:06:59 +00:00

84 lines
1.8 KiB
JavaScript

import PreviewLogsPane from '../js/features/preview/components/preview-logs-pane'
import { EditorProvider } from '../js/shared/context/editor-context'
import { ApplicationProvider } from '../js/shared/context/application-context'
import useFetchMock from './hooks/use-fetch-mock'
import { IdeProvider } from '../js/shared/context/ide-context'
export const TimedOutError = args => {
useFetchMock(fetchMock => {
fetchMock.post('express:/event/:key', 202)
})
const ide = {
$scope: {
$watch: () => () => null,
project: {
owner: {
_id: window.user.id,
},
features: {
compileGroup: 'standard',
},
},
},
}
return (
<ApplicationProvider>
<IdeProvider ide={ide}>
<EditorProvider settings={{}}>
<PreviewLogsPane {...args} />
</EditorProvider>
</IdeProvider>
</ApplicationProvider>
)
}
TimedOutError.args = {
errors: {
timedout: {},
},
}
export const TimedOutErrorWithPriorityCompile = args => {
useFetchMock(fetchMock => {
fetchMock.post('express:/event/:key', 202)
})
const ide = {
$scope: {
$watch: () => () => null,
project: {
owner: {
_id: window.user.id,
},
features: {
compileGroup: 'priority',
},
},
},
}
return (
<ApplicationProvider>
<IdeProvider ide={ide}>
<EditorProvider settings={{}}>
<PreviewLogsPane {...args} />
</EditorProvider>
</IdeProvider>
</ApplicationProvider>
)
}
TimedOutErrorWithPriorityCompile.args = {
errors: {
timedout: {},
},
}
export default {
title: 'Preview Logs / Pane',
component: PreviewLogsPane,
argTypes: {
onLogEntryLocationClick: { action: 'log entry location' },
onClearCache: { action: 'clear cache' },
},
}