forked from 18xx-maker/18xx-maker
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathLegend.jsx
executable file
·36 lines (34 loc) · 1.05 KB
/
Legend.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import React from "react";
import Color from "./util/Color";
import { multiDefaultTo } from "./util";
const Legend = ({ game, color, borderColor, borderWidth, description, right, bottom, fontFamily, fontSize, fontWeight }) => {
fontFamily = multiDefaultTo("display", fontFamily);
fontSize = multiDefaultTo("14", fontSize);
fontWeight = multiDefaultTo("normal", fontWeight);
return (
<Color>
{(c,t) => (
<g>
{/* <circle r="12" cx={right ? -20 : 20} cy={bottom ? -20 : 20}
stroke={c(borderColor || "black")}
strokeWidth={borderWidth || 2}
fill={c(color || "orange")}
/> */}
<text
fontFamily="Times"
fontSize="16"
fontWeight="bold"
textAnchor={right ? "end" : "start"}
dominantBaseline="middle"
fill="black"
x={right ? -39 : 39}
y={bottom ? -20 : 20}
>
{description}
</text>
</g>
)}
</Color>
);
};
export default Legend;