Created
October 28, 2021 19:17
-
-
Save akinolu52/825117c3abb25e5b6f6bfc65983a4dd6 to your computer and use it in GitHub Desktop.
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 styled from 'styled-components/native'; | |
const ProgressBar = ({progress, height = 8, outerBackgroundColor, innerBackgroundColor, padded = true}) => ( | |
<Container | |
height={height} | |
padded={padded} | |
outerBackgroundColor={outerBackgroundColor} | |
> | |
<Content | |
height={height} | |
padded={padded} | |
progress={progress} | |
innerBackgroundColor={innerBackgroundColor} | |
/> | |
</Container> | |
); | |
const Container = styled.View` | |
width: "100%"; | |
borderRadius: 16; | |
alignItems: flex-start; | |
justifyContent: center; | |
height: ${props => props.height}; | |
backgroundColor: ${props => props.outerBackgroundColor}; | |
paddingHorizontal: ${props => props.padded ? 3 : 0}; | |
`; | |
const Content = styled.View` | |
borderRadius: 16; | |
height: ${props => props.padded ? (props.height / 2) : props.height}; | |
backgroundColor: ${props => props.innerBackgroundColor}; | |
width: ${props => props.progress}%; | |
`; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment