-
Notifications
You must be signed in to change notification settings - Fork 48k
/
Copy pathCircle.js
48 lines (40 loc) · 1.01 KB
/
Circle.js
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
38
39
40
41
42
43
44
45
46
47
48
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
* @typechecks
*
* Example usage:
* <Circle
* radius={10}
* stroke="green"
* strokeWidth={3}
* fill="blue"
* />
*
*/
'use strict';
var assign = Object.assign;
var React = require('react');
var ReactART = require('react-art');
var createReactClass = require('create-react-class');
var Path = ReactART.Path;
var Shape = ReactART.Shape;
/**
* Circle is a React component for drawing circles. Like other ReactART
* components, it must be used in a <Surface>.
*/
var Circle = createReactClass({
displayName: 'Circle',
render: function render() {
var radius = this.props.radius;
var path = Path()
.moveTo(0, -radius)
.arc(0, radius * 2, radius)
.arc(0, radius * -2, radius)
.close();
return React.createElement(Shape, assign({}, this.props, {d: path}));
},
});
module.exports = Circle;