-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Create credits route * Add base components to credits page * Add bar chart * Add link to sidebar
- Loading branch information
Showing
19 changed files
with
566 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import React from "react"; | ||
import { | ||
CartesianGrid, | ||
BarChart as BasicBarChart, | ||
ResponsiveContainer, | ||
XAxis, | ||
YAxis, | ||
Bar, | ||
} from "recharts"; | ||
import { barChartColors, theme } from "theme"; | ||
|
||
type BarChartProps = { | ||
data?: { | ||
name: string; | ||
value: number | number[]; | ||
}[]; | ||
legendLabels: string[]; | ||
}; | ||
|
||
const BarChart: React.FC<BarChartProps> = ({ data, legendLabels }) => { | ||
const chartLinesColor = theme.greyColor20; | ||
const chartTicksColor = theme.lightTextColor; | ||
|
||
return ( | ||
<ResponsiveContainer> | ||
<BasicBarChart data={data} margin={{ right: 12 }}> | ||
<CartesianGrid vertical={false} stroke={chartLinesColor} /> | ||
<XAxis | ||
dataKey="name" | ||
axisLine={false} | ||
tickLine={false} | ||
stroke={chartTicksColor} | ||
tick={{ fontSize: "11px" }} | ||
tickSize={10} | ||
/> | ||
<YAxis | ||
axisLine={false} | ||
tickLine={false} | ||
stroke={chartTicksColor} | ||
tick={{ fontSize: "11px" }} | ||
tickSize={10} | ||
/> | ||
{legendLabels.map((barName, key) => ( | ||
<Bar dataKey={barName} fill={barChartColors[key]} /> | ||
))} | ||
</BasicBarChart> | ||
</ResponsiveContainer> | ||
); | ||
}; | ||
|
||
export default React.memo(BarChart); |
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,4 @@ | ||
import BarChart from "./BarChart"; | ||
|
||
export default BarChart; | ||
export { BarChart }; |
Oops, something went wrong.