-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: update Trainer component and add tests * chore: add TrainersList tests * Disable lint for redux devtools extension * chore: update argument naming to be more meaningful * Add react-svg-piechart (#24) * Add react-svg-piechart * Update after CR
- Loading branch information
Piotr Zientara
authored
Aug 15, 2018
1 parent
b3a2e01
commit 279614f
Showing
7 changed files
with
48 additions
and
15 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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 @@ | ||
export const VOTES_NEEDED = 40; |
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
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 |
---|---|---|
@@ -1,17 +1,42 @@ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
import PropTypes from 'prop-types'; | ||
import PieChart from 'react-svg-piechart'; | ||
import Colors from '../../styles/Colors'; | ||
import {VOTES_NEEDED} from '../../settings'; | ||
|
||
const Participants = ({likes}) => { | ||
const missingVotes = VOTES_NEEDED - likes; | ||
const chartData = [ | ||
{title: 'Liczba głosów', value: likes, color: Colors.yellow}, | ||
{title: 'Brakujące Głosy', value: missingVotes, color: Colors.red}, | ||
]; | ||
|
||
return (<StyledParticipants> | ||
<PieChart | ||
data={chartData} | ||
expandOnHover | ||
onSectorHover={(d, i, e) => { | ||
if (d) { | ||
// eslint-disable-next-line no-console | ||
console.log('Mouse enter - Index:', i, 'Data:', d, 'Event:', e); | ||
} else { | ||
// eslint-disable-next-line no-console | ||
console.log('Mouse leave - Index:', i, 'Event:', e); | ||
} | ||
}} | ||
/> | ||
|
||
const Participants = props => ( | ||
<StyledParticipants> | ||
<img src="chart.PNG" alt="chart"/> | ||
</StyledParticipants> | ||
); | ||
); | ||
}; | ||
|
||
const StyledParticipants = styled.figure` | ||
flex: 1; | ||
img { | ||
width: 100px; | ||
} | ||
`; | ||
|
||
Participants.propTypes = { | ||
likes: PropTypes.number, | ||
}; | ||
|
||
export default Participants; |
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