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

Commit54ec7b1

Browse files
committed
add loading indicator
1 parent773a72c commit54ec7b1

File tree

4 files changed

+43
-3
lines changed

4 files changed

+43
-3
lines changed
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import*asReactfrom'react'
2+
import{Loading}from'@alifd/next'
23

3-
constLoading=()=>{
4-
return<div>Loading...</div>
4+
interfaceProps{
5+
text:string
56
}
67

7-
exportdefaultLoading
8+
constLoadingComponent=({ text}:Props)=>{
9+
return<Loadingtip={text}/>
10+
}
11+
12+
exportdefaultLoadingComponent
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import*asReactfrom'react'
2+
importLoadingfrom'../components/Loading'
3+
4+
interfaceProps{
5+
text:string
6+
}
7+
8+
conststyles={
9+
page:{
10+
display:'flex',
11+
alignItems:'center',
12+
justifyContent:'center',
13+
width:'100%',
14+
height:'100%',
15+
},
16+
}
17+
18+
constLoadingPage=({ text}:Props)=>(
19+
<divstyle={styles.page}>
20+
<Loadingtext={text}/>
21+
</div>
22+
)
23+
24+
exportdefaultLoadingPage

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
importReactfrom'react'
2+
3+
import{storiesOf}from'@storybook/react'
4+
importSideBarDecoratorfrom'./utils/SideBarDecorator'
5+
6+
importLoadingPagefrom'../src/containers/LoadingPage'
7+
8+
storiesOf('Components',module)
9+
.addDecorator(SideBarDecorator)
10+
.add('Loading',()=><LoadingPagetext="Content"/>)

‎web-app/stories/utils/SideBarDecorator.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as React from 'react'
33
conststyles={
44
width:'20rem',
55
borderRight:'2px solid black',
6+
height:window.innerHeight,
67
}
78

89
constSideBarDecorator=storyFn=><divstyle={styles}>{storyFn()}</div>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp