Skip to content

Commit 42719d0

Browse files
authoredFeb 2, 2020
Merge pull request #102 from ShMcK/feature/notify
Icons, Fonts & Notifications
·
v0.19.40.2.0
2 parents bac9dc8 + be1e1db commit 42719d0

34 files changed

+461
-156
lines changed
 

‎package-lock.json‎

Lines changed: 0 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"build": "rm -rf build && npm run build:ext && npm run build:web",
2121
"build:ext": "tsc -p ./",
2222
"build:web": "cd web-app && npm run build",
23-
"postbuild:web": "cp -R ./web-app/build/ ./build/",
23+
"postbuild:web": "cp -R ./web-app/build/ ./build/ && node scripts/fixFontPaths.js",
2424
"postinstall": "node ./node_modules/vscode/bin/install",
2525
"lint": "eslint src/**/*ts",
2626
"machine": "node ./out/state/index.js",
@@ -41,7 +41,6 @@
4141
"@types/assert": "^1.4.5",
4242
"@types/chokidar": "^2.1.3",
4343
"@types/dotenv": "^8.2.0",
44-
"@types/glob": "^7.1.1",
4544
"@types/jest": "^25.1.1",
4645
"@types/jsdom": "^12.2.4",
4746
"@types/node": "^13.5.3",

‎resources/public/favicon.ico‎

-3.78 KB
Binary file not shown.

‎resources/public/index.html‎

Lines changed: 0 additions & 40 deletions
This file was deleted.

‎resources/public/manifest.json‎

Lines changed: 0 additions & 15 deletions
This file was deleted.

‎scripts/fixFontPaths.js‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* css url font paths do not match up from the web-app as it is moved inside of build
3+
* in order to load fonts and icons, these paths must be reconciled.
4+
*/
5+
const fs = require('fs') // eslint-disable-line
6+
7+
// find the generated main css file
8+
const getMainCSSFile = () => {
9+
const regex = /^main.[a-z0-9]+.chunk.css$/
10+
const mainCss = fs.readdirSync('build/static/css').filter(filename => filename.match(regex))
11+
if (!mainCss.length) {
12+
throw new Error('No main.css file found in build/static/css')
13+
}
14+
return mainCss[0]
15+
}
16+
17+
// remap the font paths from the borken /fonts/ => ../../fonts/
18+
const remapFontPaths = () => {
19+
const mainCSSFile = getMainCSSFile()
20+
const file = fs.readFileSync(`build/static/css/${mainCSSFile}`, 'utf8')
21+
const fontUrlRegex = /url\(\/fonts\//g
22+
const remappedFile = file.replace(fontUrlRegex, 'url(../../fonts/')
23+
fs.writeFileSync(`build/static/css/${mainCSSFile}`, remappedFile)
24+
}
25+
26+
remapFontPaths()

‎src/editor/commands.ts‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,11 @@ export const createCommands = ({ extensionPath, workspaceState, workspaceRoot }:
5757
testRunner = createTestRunner(config, {
5858
onSuccess: (payload: Payload) => {
5959
// send test pass message back to client
60-
notify({ message: 'PASS' })
6160
webview.send({ type: 'TEST_PASS', payload })
62-
// update local storage
6361
},
6462
onFail: (payload: Payload, message: string) => {
65-
// send test fail message back to client
66-
notify({ message: `FAIL ${message}` })
67-
webview.send({ type: 'TEST_FAIL', payload })
63+
// send test fail message back to client with failure message
64+
webview.send({ type: 'TEST_FAIL', payload: { ...payload, message } })
6865
},
6966
onError: (payload: Payload) => {
7067
// send test error message back to client

‎tsconfig.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@
2525
"allowJs": true,
2626
"removeComments": true
2727
},
28-
"exclude": ["node_modules", ".vscode-test", "build", "resources", "web-app", "*.js", "*.test.ts"]
28+
"exclude": ["node_modules", ".vscode-test", "build", "resources", "web-app", "*.js", "*.test.ts", "scripts"]
2929
}

‎typings/index.d.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,20 @@ export interface ErrorMessage {
4242
description?: string
4343
}
4444

45+
export interface TestStatus {
46+
type: 'success' | 'warning' | 'error' | 'loading'
47+
title: string
48+
content?: string
49+
}
50+
4551
export interface MachineContext {
4652
env: Environment
4753
error: ErrorMessage | null
4854
tutorial: G.Tutorial | null
4955
position: Position
5056
progress: Progress
5157
processes: ProcessEvent[]
58+
testStatus: TestStatus | null
5259
}
5360

5461
export interface MachineEvent {
@@ -83,7 +90,6 @@ export interface MachineStateSchema {
8390
TestRunning: {}
8491
TestPass: {}
8592
TestFail: {}
86-
TestError: {}
8793
StepNext: {}
8894
LevelComplete: {}
8995
}

‎web-app/config-overrides.js‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/* eslint-disable @typescript-eslint/no-var-requires */
2-
const path = require('path')
3-
const { addBabelPreset, addBabelPlugin, addWebpackModuleRule } = require('customize-cra')
2+
const { addBabelPreset, addWebpackModuleRule, addBabelPlugin } = require('customize-cra')
43

54
module.exports = function override(config) {
65
addWebpackModuleRule({

‎web-app/src/Routes.tsx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const Routes = () => {
2323
<Route path={['Start.LoadTutorialSummary', 'Start.LoadTutorialData', 'Start.SetupNewTutorial']}>
2424
<LoadingPage text="Loading Tutorial..." context={context} />
2525
</Route>
26-
<Route path={'Start.Error'}>
26+
<Route path="Start.Error">
2727
<LoadingPage text="Error" context={context} />
2828
</Route>
2929
<Route path="Start.SelectTutorial">
@@ -32,11 +32,11 @@ const Routes = () => {
3232
<Route path="Start.Summary">
3333
<OverviewPage send={send} context={context} />
3434
</Route>
35-
<Route path="SetupNewTutorial">
35+
<Route path="Start.SetupNewTutorial">
3636
<LoadingPage text="Configuring tutorial..." context={context} />
3737
</Route>
3838
{/* Tutorial */}
39-
<Route path="Tutorial.LoadNext">
39+
<Route path={['Tutorial.LoadNext', 'Tutorial.Level.Load']}>
4040
<LoadingPage text="Loading Level..." context={context} />
4141
</Route>
4242
<Route path="Tutorial.Level">

‎web-app/src/components/Button/index.tsx‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,19 @@ interface Props {
77
disabled?: boolean
88
type?: 'primary' | 'secondary' | 'normal'
99
onClick?: () => void
10+
size?: 'small' | 'medium' | 'large'
11+
iconSize?: 'xxs' | 'xs' | 'small' | 'medium' | 'large' | 'xl' | 'xxl' | 'xxxl'
1012
}
1113

1214
const Button = (props: Props) => (
13-
<AlifdButton onClick={props.onClick} type={props.type} disabled={props.disabled} style={props.style}>
15+
<AlifdButton
16+
onClick={props.onClick}
17+
type={props.type}
18+
disabled={props.disabled}
19+
style={props.style}
20+
size={props.size}
21+
iconSize={props.iconSize}
22+
>
1423
{props.children}
1524
</AlifdButton>
1625
)
Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,5 @@
11
import * as React from 'react'
2-
import { css, jsx } from '@emotion/core'
3-
4-
const styles = {
5-
box: {
6-
display: 'flex',
7-
alignItems: 'center',
8-
justifyContent: 'center',
9-
},
10-
input: {
11-
border: '1px solid black',
12-
},
13-
loading: {
14-
backgroundColor: 'red',
15-
},
16-
}
2+
import { Checkbox as AlifdCheckbox } from '@alifd/next'
173

184
interface Props {
195
status: 'COMPLETE' | 'INCOMPLETE' | 'ACTIVE'
@@ -26,13 +12,7 @@ const Checkbox = (props: Props) => {
2612

2713
const checked = props.status === 'COMPLETE'
2814

29-
return (
30-
<div css={styles.box}>
31-
<label>
32-
<input css={styles.input} type="checkbox" checked={checked} onChange={onChange} />
33-
</label>
34-
</div>
35-
)
15+
return <AlifdCheckbox checked={checked} onChange={onChange} />
3616
}
3717

3818
export default Checkbox

‎web-app/src/components/Message/index.tsx‎

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,35 @@ import { Message as AlifdMessage } from '@alifd/next'
22
import * as React from 'react'
33

44
interface Props {
5-
type: 'error'
5+
type?: 'success' | 'warning' | 'error' | 'notice' | 'help' | 'loading'
6+
shape?: 'inline' | 'addon' | 'toast'
7+
size?: 'medium' | 'large'
68
title: string
7-
description?: string
9+
content?: string
10+
closed?: boolean
11+
closeable?: boolean
12+
onClose?: () => void
13+
handleClose?: () => void
814
}
915

1016
const Message = (props: Props) => {
17+
const [visible, setVisible] = React.useState(true)
18+
function onClose() {
19+
if (props.onClose) {
20+
props.onClose()
21+
}
22+
setVisible(false)
23+
}
1124
return (
12-
<AlifdMessage type={props.type} title={props.title}>
13-
{props.description}
25+
<AlifdMessage
26+
type={props.type}
27+
visible={props.closed ? !props.closed : visible}
28+
title={props.title}
29+
closeable={props.closeable}
30+
onClose={onClose}
31+
shape={props.shape}
32+
>
33+
{props.content}
1434
</AlifdMessage>
1535
)
1636
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import Message from '../Message'
2+
import * as React from 'react'
3+
import * as T from 'typings'
4+
import { css, jsx } from '@emotion/core'
5+
6+
const durations = {
7+
success: 1000,
8+
warning: 4500,
9+
error: 4500,
10+
loading: 300000,
11+
}
12+
13+
const useTimeout = ({ duration, key }: { duration: number; key: string }) => {
14+
const [timeoutClose, setTimeoutClose] = React.useState(false)
15+
React.useEffect(() => {
16+
setTimeoutClose(false)
17+
const timeout = setTimeout(() => {
18+
setTimeoutClose(true)
19+
}, duration)
20+
return () => {
21+
clearTimeout(timeout)
22+
}
23+
}, [key])
24+
return timeoutClose
25+
}
26+
27+
const TestMessage = (props: T.TestStatus) => {
28+
const duration = durations[props.type]
29+
const timeoutClose = useTimeout({ duration, key: props.title })
30+
return (
31+
<Message
32+
key={props.title}
33+
type={props.type}
34+
title={props.title}
35+
closed={timeoutClose}
36+
size="medium"
37+
closeable={props.type !== 'loading'}
38+
content={props.content}
39+
/>
40+
)
41+
}
42+
43+
export default TestMessage
Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
import { Message as AlifdMessage } from '@alifd/next'
1+
import Message from '../Message'
22
import * as React from 'react'
33
import * as T from 'typings'
44
import { css, jsx } from '@emotion/core'
5+
import TestMessage from './TestMessage'
56

67
interface Props {
8+
testStatus: T.TestStatus | null
79
processes: T.ProcessEvent[]
810
}
911

@@ -15,19 +17,20 @@ const styles = {
1517
}
1618

1719
// display a list of active processes
18-
const ProcessEvents = ({ processes }: Props) => {
20+
const ProcessMessages = ({ processes, testStatus }: Props) => {
21+
if (testStatus) {
22+
return <TestMessage {...testStatus} />
23+
}
1924
if (!processes.length) {
2025
return null
2126
}
2227
return (
2328
<div css={styles.container}>
2429
{processes.map(process => (
25-
<AlifdMessage key={process.title} type="loading" size="medium" title={process.title}>
26-
{process.description}
27-
</AlifdMessage>
30+
<Message key={process.title} type="loading" size="medium" title={process.title} content={process.description} />
2831
))}
2932
</div>
3033
)
3134
}
3235

33-
export default ProcessEvents
36+
export default ProcessMessages

‎web-app/src/containers/LoadingPage.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const LoadingPage = ({ text, context }: Props) => {
2525
if (error) {
2626
return (
2727
<div css={styles.page}>
28-
<Message type="error" title={error.title} description={error.description} />
28+
<Message type="error" title={error.title} content={error.description} />
2929
</div>
3030
)
3131
}

‎web-app/src/containers/Overview/OverviewPage.tsx‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as React from 'react'
22
import * as G from 'typings/graphql'
33
import Button from '../../components/Button'
4+
import Icon from '../../components/Icon'
45
import Markdown from '../../components/Markdown'
56

67
const footerHeight = '3rem'
@@ -23,11 +24,13 @@ const styles = {
2324
fontSize: '1rem',
2425
},
2526
header: {
27+
display: 'flex',
2628
height: '2rem',
2729
backgroundColor: '#EBEBEB',
2830
fontSize: '1rem',
2931
lineHeight: '1rem',
3032
padding: '10px 1rem',
33+
alignItems: 'center',
3134
},
3235
levelList: {
3336
padding: '0rem 1rem',
@@ -61,7 +64,10 @@ const Summary = ({ title, description, levels, onNext, onBack }: Props) => (
6164
<div css={styles.page}>
6265
<div>
6366
<div css={styles.header}>
64-
<button onClick={onBack}>Back</button>
67+
<button onClick={onBack}>
68+
<Icon type="arrow-left" size="xxs" />
69+
</button>
70+
<span>&nbsp;&nbsp;</span>
6571
<span>CodeRoad</span>
6672
</div>
6773
<div css={styles.summary}>

‎web-app/src/containers/Overview/index.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import * as G from 'typings/graphql'
55
import ErrorView from '../../components/Error'
66
import queryTutorial from '../../services/apollo/queries/tutorial'
77
import OverviewPage from './OverviewPage'
8+
import LoadingPage from '../../containers/LoadingPage'
89

910
interface PageProps {
1011
context: CR.MachineContext
@@ -35,7 +36,7 @@ const Overview = (props: PageProps) => {
3536
})
3637

3738
if (loading) {
38-
return <div>Loading Summary...</div>
39+
return <LoadingPage text="Loading Summary..." context={props.context} />
3940
}
4041

4142
if (error) {

‎web-app/src/containers/Tutorial/LevelPage/Level.tsx‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as G from 'typings/graphql'
44
import { css, jsx } from '@emotion/core'
55
import Button from '../../../components/Button'
66
import Markdown from '../../../components/Markdown'
7-
import ProcessEvents from '../../../components/ProcessEvents'
7+
import ProcessMessages from '../../../components/ProcessMessages'
88
import Step from './Step'
99

1010
const styles = {
@@ -68,11 +68,12 @@ const styles = {
6868
interface Props {
6969
level: G.Level & { status: T.ProgressStatus; index: number; steps: Array<G.Step & { status: T.ProgressStatus }> }
7070
processes: T.ProcessEvent[]
71+
testStatus: T.TestStatus | null
7172
onContinue(): void
7273
onLoadSolution(): void
7374
}
7475

75-
const Level = ({ level, onContinue, onLoadSolution, processes }: Props) => {
76+
const Level = ({ level, onContinue, onLoadSolution, processes, testStatus }: Props) => {
7677
if (!level.steps) {
7778
throw new Error('No Stage steps found')
7879
}
@@ -107,9 +108,9 @@ const Level = ({ level, onContinue, onLoadSolution, processes }: Props) => {
107108
</div>
108109
</div>
109110

110-
{processes.length > 0 && (
111+
{(testStatus || processes.length > 0) && (
111112
<div css={styles.processes}>
112-
<ProcessEvents processes={processes} />
113+
<ProcessMessages processes={processes} testStatus={testStatus} />
113114
</div>
114115
)}
115116

‎web-app/src/containers/Tutorial/LevelPage/index.tsx‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ interface PageProps {
1010
}
1111

1212
const LevelSummaryPageContainer = (props: PageProps) => {
13-
const { position, progress, processes, error } = props.context
13+
const { position, progress, processes, testStatus, error } = props.context
1414

1515
const version = selectors.currentVersion(props.context)
1616
const levelData: G.Level = selectors.currentLevel(props.context)
@@ -48,7 +48,15 @@ const LevelSummaryPageContainer = (props: PageProps) => {
4848
}),
4949
}
5050

51-
return <Level level={level} onContinue={onContinue} onLoadSolution={onLoadSolution} processes={processes} />
51+
return (
52+
<Level
53+
level={level}
54+
onContinue={onContinue}
55+
onLoadSolution={onLoadSolution}
56+
processes={processes}
57+
testStatus={testStatus}
58+
/>
59+
)
5260
}
5361

5462
export default LevelSummaryPageContainer

‎web-app/src/resources/fonts/next-icon.svg‎

Lines changed: 182 additions & 0 deletions
Loading
5.47 KB
Binary file not shown.
19.8 KB
Binary file not shown.
19.1 KB
Binary file not shown.
19.6 KB
Binary file not shown.
19.5 KB
Binary file not shown.
18.5 KB
Binary file not shown.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import editorActions from './editor'
2+
import commandActions from './command'
3+
import contextActions from './context'
4+
import testActions from './test'
5+
6+
const createActions = (editorSend: any) => ({
7+
...editorActions(editorSend),
8+
...commandActions,
9+
...contextActions,
10+
...testActions,
11+
})
12+
13+
export default createActions
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import * as CR from 'typings'
2+
import { assign, ActionFunctionMap } from 'xstate'
3+
4+
const testActions: ActionFunctionMap<CR.MachineContext, CR.MachineEvent> = {
5+
// @ts-ignore
6+
testStart: assign({
7+
testStatus: () => ({
8+
type: 'loading',
9+
title: 'Test running...',
10+
}),
11+
}),
12+
// @ts-ignore
13+
testPass: assign({
14+
testStatus: () => ({
15+
type: 'success',
16+
title: 'Success!',
17+
}),
18+
}),
19+
// @ts-ignore
20+
testFail: assign({
21+
testStatus: (context, event) => ({
22+
type: 'warning',
23+
title: 'Fail!',
24+
content: event.payload.message,
25+
}),
26+
}),
27+
}
28+
29+
export default testActions

‎web-app/src/services/state/machine.ts‎

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
import * as CR from 'typings'
22
import { assign, Machine, MachineOptions } from 'xstate'
3-
import editorActions from './actions/editor'
4-
import commandActions from './actions/command'
5-
import contextActions from './actions/context'
3+
import createActions from './actions'
64
import * as services from './services'
75

86
const createOptions = ({ editorSend }: any): MachineOptions<CR.MachineContext, CR.MachineEvent> => ({
97
activities: {},
10-
actions: {
11-
...editorActions(editorSend),
12-
...contextActions,
13-
...commandActions,
14-
},
8+
actions: createActions(editorSend),
159
guards: {},
1610
services: {},
1711
delays: {},
@@ -33,6 +27,7 @@ export const createMachine = (options: any) => {
3327
complete: false,
3428
},
3529
processes: [],
30+
testStatus: null,
3631
},
3732
states: {
3833
Start: {
@@ -130,7 +125,7 @@ export const createMachine = (options: any) => {
130125
ContinueTutorial: {
131126
on: {
132127
TUTORIAL_START: {
133-
target: '#tutorial',
128+
target: '#tutorial-level',
134129
actions: ['continueConfig'],
135130
},
136131
TUTORIAL_SELECT: 'SelectTutorial',
@@ -195,16 +190,16 @@ export const createMachine = (options: any) => {
195190
on: {
196191
TEST_PASS: {
197192
target: 'TestPass',
198-
actions: ['updateStepProgress'],
193+
actions: ['updateStepProgress', 'testPass'],
194+
},
195+
TEST_FAIL: {
196+
target: 'TestFail',
197+
actions: ['testFail'],
198+
},
199+
TEST_ERROR: {
200+
target: 'TestFail',
201+
actions: ['testFail'],
199202
},
200-
TEST_FAIL: 'TestFail',
201-
TEST_ERROR: 'TestError',
202-
},
203-
},
204-
TestError: {
205-
onEntry: ['testFail'],
206-
after: {
207-
0: 'Normal',
208203
},
209204
},
210205
TestPass: {
@@ -214,7 +209,6 @@ export const createMachine = (options: any) => {
214209
},
215210
},
216211
TestFail: {
217-
onEntry: ['testFail'],
218212
after: {
219213
0: 'Normal',
220214
},

‎web-app/src/styles/font.css‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
@charset "UTF-8";
2+
3+
@font-face {
4+
font-family: 'NextIcon';
5+
src: url('~resources/fonts/next-icon.woff2') format('woff2'),
6+
url('~resources/fonts/next-icon.svg#NextIcon') format('svg');
7+
}
8+
@font-face {
9+
font-family: 'Roboto';
10+
src: url('~resources/fonts/roboto-thin.woff2') format('woff2');
11+
font-weight: 200;
12+
}
13+
14+
@font-face {
15+
font-family: 'Roboto';
16+
src: url('~resources/fonts/roboto-light.woff2') format('woff2');
17+
font-weight: 300;
18+
}
19+
20+
@font-face {
21+
font-family: 'Roboto';
22+
src: url('~resources/fonts/roboto-regular.woff2') format('woff2');
23+
font-weight: 400;
24+
}
25+
26+
@font-face {
27+
font-family: 'Roboto';
28+
src: url('~resources/fonts/roboto-medium.woff2') format('woff2');
29+
font-weight: 500;
30+
}
31+
32+
@font-face {
33+
font-family: 'Roboto';
34+
src: url('~resources/fonts/roboto-bold.woff2') format('woff2');
35+
font-weight: 700;
36+
}

‎web-app/src/styles/index.css‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
@import '~@alifd/theme-4/dist/next.css';
1+
@import '~@alifd/next/dist/next.min.css';
2+
/* @import '~@alifd/theme-4/dist/next.css'; */
3+
@import './font.css';
24

35
html {
46
height: 100%;

‎web-app/stories/Commands.stories.tsx‎

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { storiesOf } from '@storybook/react'
22
import React from 'react'
3-
import ProcessEvents from '../src/components/ProcessEvents'
3+
import ProcessMessages from '../src/components/ProcessMessages'
44
import SideBarDecorator from './utils/SideBarDecorator'
55

66
const styles = {
@@ -13,7 +13,8 @@ const styles = {
1313
storiesOf('Components', module)
1414
.addDecorator(SideBarDecorator)
1515
.add('Processes', () => (
16-
<ProcessEvents
16+
<ProcessMessages
17+
testStatus={null}
1718
processes={[
1819
{
1920
title: 'npm install',
@@ -26,3 +27,31 @@ storiesOf('Components', module)
2627
]}
2728
/>
2829
))
30+
.add('Test Start', () => (
31+
<ProcessMessages
32+
testStatus={{
33+
type: 'loading',
34+
title: 'Test running...',
35+
}}
36+
processes={[]}
37+
/>
38+
))
39+
.add('Test Pass', () => (
40+
<ProcessMessages
41+
testStatus={{
42+
type: 'success',
43+
title: 'Success!',
44+
}}
45+
processes={[]}
46+
/>
47+
))
48+
.add('Test Fail', () => (
49+
<ProcessMessages
50+
testStatus={{
51+
type: 'warning',
52+
title: 'Fail!',
53+
content: 'Test failed for some reason',
54+
}}
55+
processes={[]}
56+
/>
57+
))

0 commit comments

Comments
 (0)
Please sign in to comment.