Skip to content

Feature/on reset #388

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jul 12, 2020
Prev Previous commit
Next Next commit
refactor StepProgress
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
  • Loading branch information
ShMcK committed Jul 12, 2020
commit 0d5ef9d4384fc958ae96f3afd47b247afa278c32
41 changes: 41 additions & 0 deletions web-app/src/containers/Tutorial/components/StepProgress.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import * as React from 'react'
import { Progress } from '@alifd/next'

const styles = {
progress: {
display: 'flex' as 'flex',
justifyContent: 'flex-end' as 'flex-end',
alignItems: 'center' as 'center',
width: '10rem',
color: 'white',
},
text: { color: 'white' },
}

interface Props {
current: number
max: number
}

const StepProgress = (props: Props) => {
const Text = (
<span style={styles.text}>
{props.current} of {props.max}
</span>
)
return (
<Progress
state="success"
progressive
percent={(props.current / props.max) * 100}
shape="line"
color="rgb(85, 132, 255)"
css={styles.progress}
textRender={() => {
return Text
}}
/>
)
}

export default StepProgress
29 changes: 4 additions & 25 deletions web-app/src/containers/Tutorial/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import * as selectors from '../../services/selectors'
import SideMenu from './components/SideMenu'
import Level from './components/Level'
import Icon from '../../components/Icon'
// import SettingsPage from './containers/Settings'
import ReviewPage from './containers/Review'
import Button from '../../components/Button'
import Reset from './components/Reset'
import ProcessMessages from '../../components/ProcessMessages'
import TestMessage from '../../components/TestMessage'
import { Progress } from '@alifd/next'
import StepProgress from './components/StepProgress'
import { DISPLAY_RUN_TEST_BUTTON } from '../../environment'
import formatLevels from './formatLevels'
// import SettingsPage from './containers/Settings'
// import Reset from './components/Reset'

const styles = {
header: {
Expand Down Expand Up @@ -48,13 +48,6 @@ const styles = {
right: 0,
color: 'white',
},
taskProgress: {
display: 'flex' as 'flex',
justifyContent: 'flex-end' as 'flex-end',
alignItems: 'center' as 'center',
width: '10rem',
color: 'white',
},
processes: {
padding: '0 1rem',
position: 'fixed' as 'fixed',
Expand Down Expand Up @@ -165,21 +158,7 @@ const TutorialPage = (props: PageProps) => {
Continue
</Button>
) : (
<Progress
state="success"
progressive
percent={(stepIndex / level.steps.length) * 100}
shape="line"
color="rgb(85, 132, 255)"
css={styles.taskProgress}
textRender={() => {
return (
<span style={{ color: 'white' }}>
{stepIndex} of {level.steps.length}
</span>
)
}}
/>
<StepProgress current={stepIndex} max={level.steps.length} />
)}
</div>
</div>
Expand Down