43 lines
1.3 KiB
JavaScript
43 lines
1.3 KiB
JavaScript
const preact = require('preact');
|
|
|
|
module.exports = function charge(x, y, height, colour) {
|
|
return (
|
|
<svg>
|
|
<polygon
|
|
points={`
|
|
${x},${y - height}
|
|
${x - 2 * height},${y + 2 * height}
|
|
${x + 2 * height},${y + 2 * height}
|
|
`}
|
|
stroke="#a52a2a"
|
|
stroke-width="2"
|
|
id="charge"
|
|
/>
|
|
<polyline
|
|
points={`
|
|
${x + 2 * height},${y + 2 * height}
|
|
${x + 3.5 * height},${y + height}
|
|
${x},${y - 4 * height}
|
|
${x - 3.5 * height},${y + height}
|
|
${x - 2 * height},${y + 2 * height}
|
|
`}
|
|
stroke="#a52a2a"
|
|
stroke-width="2"
|
|
id="charge"
|
|
/>
|
|
<polyline
|
|
points={`
|
|
${x + 3.5 * height},${y + height}
|
|
${x + 5 * height},${y}
|
|
${x},${y - 7 * height}
|
|
${x - 5 * height},${y}
|
|
${x - 3.5 * height},${y + height}
|
|
`}
|
|
stroke={colour}
|
|
stroke-width="2"
|
|
id="charge"
|
|
/>
|
|
</svg>
|
|
);
|
|
}
|