1- require ( './ProgressBar.scss' )
2-
31import React from 'react'
42import classNames from 'classnames'
53
6- const ProgressBar = ( { completionPercentage, checkPoints} ) => {
4+ require ( './ProgressBar.scss' )
5+
6+ const ProgressBar = ( { completionPercentage, checkPoints} ) => {
77 function getCheckPointPositionStyle ( percentage ) {
88 const style = {
99 left :percentage + '%'
1010 }
1111 return style
1212 }
13-
13+
1414 function getCheckPointPositionScaledStyle ( percentage ) {
1515 percentage = Number . parseInt ( percentage ) * 0.8
1616 const style = {
1717 left :percentage + '%'
1818 }
1919 return style
2020 }
21-
21+
2222 function getLengthScaledStyle ( percentage ) {
2323 const style = {
2424 width :percentage + '%'
2525 }
2626 return style
2727 }
28-
28+
2929 function checkPointStyle ( checkPointPercentage ) {
3030 checkPointPercentage = Number . parseInt ( checkPointPercentage )
3131 completionPercentage = Number . parseInt ( completionPercentage )
3232 const checkPointClass = classNames (
33- 'circle' , { completed : ( checkPointPercentage <= completionPercentage ) }
33+ 'circle' ,
34+ { completed : ( checkPointPercentage <= completionPercentage ) }
3435 )
3536 return checkPointClass
3637 }
37-
38+
3839 return (
3940 < div className = "ProgressBar" >
4041 < div className = "progress-box" >
4142 < div className = "checkpoint-line" >
42- { checkPoints . map ( ( checkPoint , index ) => {
43+ { checkPoints . map ( ( checkPoint , index ) => {
4344 return < div className = "checkpoint-text" style = { getCheckPointPositionScaledStyle ( checkPoint . completionPercentage ) } key = { index } > { checkPoint . name } </ div >
4445 } ) }
4546 </ div >
@@ -50,13 +51,13 @@ const ProgressBar = ({completionPercentage,checkPoints}) => {
5051 </ div >
5152 < div className = "progress-circles" >
5253 < div className = "circle" />
53- { checkPoints . map ( ( checkPoint , index ) => {
54+ { checkPoints . map ( ( checkPoint , index ) => {
5455 return < div className = { checkPointStyle ( checkPoint . completionPercentage ) } style = { getCheckPointPositionStyle ( checkPoint . completionPercentage ) } key = { index } />
5556 } ) }
5657 </ div >
5758 </ div >
5859 < div className = "time-line" >
59- { checkPoints . map ( ( checkPoint , index ) => {
60+ { checkPoints . map ( ( checkPoint , index ) => {
6061 return < div className = "time-line-text" style = { getCheckPointPositionScaledStyle ( checkPoint . completionPercentage ) } key = { index } > { checkPoint . timeline } </ div >
6162 } ) }
6263 </ div >
@@ -70,4 +71,4 @@ ProgressBar.propTypes = {
7071 checkPoints : React . PropTypes . array
7172}
7273
73- export default ProgressBar
74+ export default ProgressBar
0 commit comments