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

Commit60c171d

Browse files
committed
create progress pie component
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
1 parent60365ef commit60c171d

File tree

2 files changed

+30
-3
lines changed

2 files changed

+30
-3
lines changed

‎web-app/src/containers/Tutorial/components/Continue.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import*asReactfrom'react'
2-
import{Dialog,Message}from'@alifd/next'
2+
import{Dialog}from'@alifd/next'
33
importButtonfrom'../../../components/Button'
4+
importProgressPiefrom'./ProgressPie'
45

56
interfaceProps{
67
onContinue():void
@@ -31,9 +32,9 @@ const Continue = (props: Props) => {
3132
onOk={onOk}
3233
onCancel={onClose}
3334
onClose={onClose}
34-
footerActions={['ok','cancel']}
35+
footerActions={['ok']}
3536
>
36-
<Message>Level Complete</Message>
37+
<ProgressPie/>
3738
</Dialog>
3839
</>
3940
)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import*asReactfrom'react'
2+
import{Progress,Icon}from'@alifd/next'
3+
4+
constProgressPie=()=>{
5+
const[progress,setProgress]=React.useState(0)
6+
7+
React.useEffect(()=>{
8+
if(progress<100){
9+
constintervals=[10,20]
10+
constrandomInteval=intervals[Math.floor(Math.random()*intervals.length)]
11+
setTimeout(()=>{
12+
setProgress(progress+randomInteval)
13+
},200)
14+
}
15+
},[progress])
16+
17+
return(
18+
<Progress
19+
percent={progress}
20+
shape="circle"
21+
textRender={()=>(progress===100 ?<Icontype="select"size="xl"/> :null)}
22+
/>
23+
)
24+
}
25+
26+
exportdefaultProgressPie

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp