-
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.
* WIP * clean up
- Loading branch information
Showing
17 changed files
with
329 additions
and
43 deletions.
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
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
19 changes: 3 additions & 16 deletions
19
src/components/Node/Stats/Stats.module.css → ...ponents/Node/Ancestry/Ancestry.module.css
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 {Ancestry} from './Ancestry'; |
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
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import {Cell, Pie, PieChart as PieChartGeneric} from 'recharts'; | ||
import {useVariable} from 'css-vars-hook'; | ||
|
||
import {useChartData} from './useChartData'; | ||
import classes from './PieChart.module.css'; | ||
|
||
const normalizeColor = color => { | ||
return color === '' ? '#4a90e2' : color; | ||
}; | ||
|
||
export const PieChart = ({completion, color}) => { | ||
const chartData = useChartData(completion); | ||
const {setRef} = useVariable('color', color); | ||
return ( | ||
<div className={classes.chart}> | ||
<PieChartGeneric width={96} height={96}> | ||
<Pie | ||
data={chartData} | ||
dataKey="value" | ||
nameKey="name" | ||
cx="50%" | ||
cy="50%" | ||
innerRadius={24} | ||
outerRadius={48} | ||
stroke="none" | ||
label={false}> | ||
{chartData.map((entry, index) => { | ||
const segmentColor = index === 0 ? normalizeColor(color) : 'rgba(66, 66, 66, 0.33)'; | ||
return <Cell key={`cell-${index}`} fill={segmentColor} />; | ||
})} | ||
</Pie> | ||
</PieChartGeneric> | ||
<div ref={setRef} className={classes.completion}> | ||
{completion}% | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
PieChart.propTypes = { | ||
completion: PropTypes.number.isRequired, | ||
color: PropTypes.string.isRequired, | ||
}; |
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,23 @@ | ||
.chart { | ||
--size: calc(16 * var(--baseUnit)); | ||
|
||
height: var(--size); | ||
margin-left: calc(2 * var(--baseUnit)); | ||
margin-right: calc(2 * var(--baseUnit)); | ||
position: relative; | ||
width: var(--size); | ||
} | ||
|
||
.completion { | ||
--size: var(--chartLabelFontSize); | ||
--color: black; | ||
|
||
color: var(--color); | ||
font-size: var(--size); | ||
height: var(--size); | ||
left: 50%; | ||
line-height: var(--size); | ||
position: absolute; | ||
top: 50%; | ||
transform: translate(-50%, -50%); | ||
} |
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 {PieChart} from './PieChart'; |
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,17 @@ | ||
/** | ||
* React hook converts completion to chart compatible format | ||
* @param {Number} completion | ||
* @return {Array.<{name: String, value: Number}>} | ||
*/ | ||
export const useChartData = completion => { | ||
return [ | ||
{ | ||
name: 'Completed', | ||
value: completion, | ||
}, | ||
{ | ||
name: 'Non-completed', | ||
value: 100 - completion, | ||
}, | ||
]; | ||
}; |
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,28 +1,29 @@ | ||
:root { | ||
--name: 'default'; | ||
--name: "default"; | ||
--baseUnit: 6px; | ||
--bgColor: #4a90e2; | ||
--accentColor: #cc8110; | ||
--secondaryColor: rgba(255, 211, 110, 0.33); | ||
--secondaryColor: rgb(255 211 110 / 33%); | ||
--darkColor: #424242; | ||
--dangerColor: #f23005; | ||
--actionColor: rgba(46, 56, 255, 1); | ||
--actionColor: rgb(46 56 255 / 100%); | ||
--confirmColor: #639423; | ||
--modalBgColor: rgba(66, 66, 66, 0.66); | ||
--iconColor: rgba(66, 66, 66, 0.66); | ||
--iconLightColor: rgba(66, 66, 66, 0.33); | ||
--modalBgColor: rgb(66 66 66 / 66%); | ||
--iconColor: rgb(66 66 66 / 66%); | ||
--iconLightColor: rgb(66 66 66 / 33%); | ||
--headerHeight: 56px; | ||
--footerHeight: calc(6 * var(--baseUnit)); | ||
--columnHeight: calc(100 * var(--baseUnit)); | ||
--baseMargin: 12px; | ||
--baseBorderRadius: 6px; | ||
--backgroundLowColor: rgba(242, 242, 242, 0.8); | ||
--backgroundMiddleColor: rgba(242, 242, 242, 0.66); | ||
--backgroundMiddleColorHover: rgba(242, 242, 242, 1); | ||
--backgroundHighColor: rgba(255, 255, 255, 0.66); | ||
--backgroundFullColor: rgba(242, 242, 242, 1); | ||
--backgroundLowColor: rgb(242 242 242 / 80%); | ||
--backgroundMiddleColor: rgb(242 242 242 / 66%); | ||
--backgroundMiddleColorHover: rgb(242 242 242 / 100%); | ||
--backgroundHighColor: rgb(255 255 255 / 66%); | ||
--backgroundFullColor: rgb(242 242 242 / 100%); | ||
--headerFontSize: 16px; | ||
--modalWidth: calc(66 * var(--baseUnit)); | ||
--modalButtonColor: rgba(230, 230, 230, 1); | ||
--modalButtonColor: rgb(230 230 230 / 100%); | ||
--imageTitleColor: var(--iconColor); | ||
--chartLabelFontSize: 14px; | ||
} |
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
Oops, something went wrong.
0b308e2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
structure – ./
structure-morewings.vercel.app
structure-git-master-morewings.vercel.app
structure.ninja