Created
December 13, 2018 00:45
-
-
Save phylliswong/41ffcd0ab53ae3da161887f9ec24791e to your computer and use it in GitHub Desktop.
Simple progress bar component with inline style
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
// ES6 JS object | |
const containerStyle = { | |
'position': 'relative', | |
'height': '20px', | |
'width': '350px', | |
'border-radius': '350px', | |
'border': '1px solid #333' | |
}; | |
// ES6 JS object | |
const fillerStyle = { | |
'background': '#1da598', | |
'height': '100%', | |
'border-radius': 'inherit', | |
'textAlign': 'center', | |
'transition': 'width .2s ease-in' | |
}; | |
// function style component | |
const ProgressBar = (props) => { | |
return ( | |
<div className='progress-bar' style={containerStyle}> | |
<Filler style={fillerStyle} /> | |
</div> | |
) | |
} | |
const Filler = (props) => { | |
return <div className='filler' /> | |
} | |
export default ProgressBar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment