forked from softvar/enhanced-github
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
60 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
|
||
const YesBar = styled.div` | ||
height: 5px; | ||
background-color: #038800; | ||
flex-basis: ${props => props.flexBasis}%; | ||
`; | ||
|
||
const NoBar = styled(YesBar)` | ||
background-color: #d33131; | ||
flex-basis: ${props => props.flexBasis}%; | ||
`; | ||
|
||
const RemainingBar = styled(YesBar)` | ||
background-color: #d9d9d9; | ||
flex-basis: ${props => props.flexBasis}%; | ||
`; | ||
|
||
const VoteBar = styled.div` | ||
display: flex; | ||
height: 5px; | ||
width: 100%; | ||
margin-bottom: 4px; | ||
margin-top: 5px; | ||
`; | ||
|
||
const ButtonProgress = ({ yesPercent, noPercent }) => { | ||
const difference = 1 / 2; //need quorum? | ||
This comment has been minimized.
Sorry, something went wrong. |
||
const yesWidth = yesPercent * 100 * difference; | ||
const noWidth = noPercent * 100 * difference; | ||
const remainingVotesPercent = 100 - (yesWidth + noWidth); | ||
|
||
return ( | ||
<> | ||
<VoteBar> | ||
{yesPercent >= noPercent ? ( | ||
<> | ||
<NoBar flexBasis={noWidth} /> | ||
<YesBar flexBasis={yesWidth} /> | ||
</> | ||
) : ( | ||
<> | ||
<YesBar flexBasis={yesWidth} /> | ||
<NoBar flexBasis={noWidth} /> | ||
</> | ||
)} | ||
<RemainingBar flexBasis={remainingVotesPercent} /> | ||
</VoteBar> | ||
</> | ||
); | ||
}; | ||
|
||
export default ButtonProgress; |
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
Yes - need quorum here