Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf7d82c8

Browse files
committed
cleanup load processes
1 parent27324bc commitf7d82c8

File tree

5 files changed

+54
-13
lines changed

5 files changed

+54
-13
lines changed

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

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

44
interfaceProps{
5-
type:'error'
5+
type?:'success'|'warning'|'error'|'notice'|'help'|'loading'
66
title:string
7-
description?:string
7+
shape?:'inline'|'addon'|'toast'
8+
size?:'medium'|'large'
9+
children?:string
10+
closeable?:boolean
11+
onClose?:()=>void
12+
handleClose?:()=>void
813
}
914

1015
constMessage=(props:Props)=>{
16+
const[visible,setVisible]=React.useState(true)
17+
functiononClose(){
18+
if(props.onClose){
19+
props.onClose()
20+
}
21+
setVisible(false)
22+
}
1123
return(
12-
<AlifdMessagetype={props.type}title={props.title}>
13-
{props.description}
24+
<AlifdMessage
25+
type={props.type}
26+
visible={visible}
27+
title={props.title}
28+
closeable={props.closeable}
29+
onClose={onClose}
30+
shape={props.shape}
31+
>
32+
{props.children}
1433
</AlifdMessage>
1534
)
1635
}

‎web-app/src/components/ProcessEvents/index.tsxrenamed to‎web-app/src/components/ProcessMessages/index.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import{MessageasAlifdMessage}from'@alifd/next'
1+
importMessagefrom'../Message'
22
import*asReactfrom'react'
33
import*asTfrom'typings'
44
import{css,jsx}from'@emotion/core'
@@ -15,19 +15,19 @@ const styles = {
1515
}
1616

1717
// display a list of active processes
18-
constProcessEvents=({ processes}:Props)=>{
18+
constProcessMessages=({ processes}:Props)=>{
1919
if(!processes.length){
2020
returnnull
2121
}
2222
return(
2323
<divcss={styles.container}>
2424
{processes.map(process=>(
25-
<AlifdMessagekey={process.title}type="loading"size="medium"title={process.title}>
25+
<Messagekey={process.title}type="loading"size="medium"title={process.title}>
2626
{process.description}
27-
</AlifdMessage>
27+
</Message>
2828
))}
2929
</div>
3030
)
3131
}
3232

33-
exportdefaultProcessEvents
33+
exportdefaultProcessMessages

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

Lines changed: 2 additions & 2 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
importButtonfrom'../../../components/Button'
66
importMarkdownfrom'../../../components/Markdown'
7-
importProcessEventsfrom'../../../components/ProcessEvents'
7+
importProcessMessagesfrom'../../../components/ProcessMessages'
88
importStepfrom'./Step'
99

1010
conststyles={
@@ -109,7 +109,7 @@ const Level = ({ level, onContinue, onLoadSolution, processes }: Props) => {
109109

110110
{processes.length>0&&(
111111
<divcss={styles.processes}>
112-
<ProcessEventsprocesses={processes}/>
112+
<ProcessMessagesprocesses={processes}/>
113113
</div>
114114
)}
115115

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

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

66
conststyles={
@@ -13,7 +13,7 @@ const styles = {
1313
storiesOf('Components',module)
1414
.addDecorator(SideBarDecorator)
1515
.add('Processes',()=>(
16-
<ProcessEvents
16+
<ProcessMessages
1717
processes={[
1818
{
1919
title:'npm install',
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import{storiesOf}from'@storybook/react'
2+
importReactfrom'react'
3+
import{css,jsx}from'@emotion/core'
4+
importSideBarDecoratorfrom'./utils/SideBarDecorator'
5+
importMessagefrom'../src/components/Message'
6+
7+
conststyles={
8+
container:{
9+
display:'flex'as'flex',
10+
flexDirection:'column'as'column',
11+
},
12+
}
13+
14+
storiesOf('Test Notification',module)
15+
.addDecorator(SideBarDecorator)
16+
.add('Toast',()=>{
17+
return(
18+
<divcss={styles.container}>
19+
<Messagetitle="Test"closeable/>
20+
</div>
21+
)
22+
})

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp