Press n or j to go to the next uncovered block, b, p or k for the previous block.
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 37 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 56x 56x 56x 56x 56x 56x 56x 56x 56x 56x 56x 56x 56x 56x 56x 56x 56x 56x 1x 1x | import * as React from "react" import { observer } from "mobx-react" type TriangleProps = Readonly<{ cx: number cy: number r: number fill?: string stroke?: string strokeWidth?: number transform?: string }> & React.SVGProps<SVGPolygonElement> @observer export class Triangle extends React.Component<TriangleProps> { render(): JSX.Element { const { cx, cy, r } = this.props const x = cx - r, y = cy - r const points = [ [x, y + r * 2], [x + (r * 2) / 2, y], [x + r * 2, y + r * 2], ] return ( <polygon points={points .map((p) => `${p[0].toFixed(2)},${p[1].toFixed(2)}`) .join(" ")} {...this.props} /> ) } } |