Skip to content

Commit e357474

Browse files
committed
Step 13
1 parent 6002c8c commit e357474

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

pages/index.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,23 @@ export async function getStaticProps() {
2424
};
2525
}
2626

27-
import { TreeMap } from "@nivo/treemap";
27+
import { TreeMap, TreeMapDefaultProps as TreeMapDefault } from "@nivo/treemap";
28+
29+
function Node(props) {
30+
const { country } = props.node.data;
31+
return (
32+
<a href={`country/${country}`}>
33+
<TreeMapDefault.nodeComponent {...props} />
34+
</a>
35+
);
36+
}
2837

2938
export default function HomePage({ date, rows }) {
3039
return (
3140
<>
3241
<h2>Coronavirus {date}</h2>
3342
<TreeMap
43+
nodeComponent={Node}
3444
tile="binary"
3545
colorBy="flag"
3646
colors={{ scheme: "pastel2" }}

0 commit comments

Comments
 (0)