1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 | 'use strict';
|
19 |
|
20 | var assign = require('object-assign');
|
21 | var PropTypes = require('prop-types');
|
22 | var React = require('react');
|
23 | var ReactART = require('react-art');
|
24 |
|
25 | var createReactClass = require('create-react-class');
|
26 |
|
27 | var Path = ReactART.Path;
|
28 | var Shape = ReactART.Shape;
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 | var Circle = createReactClass({
|
35 | displayName: 'Circle',
|
36 |
|
37 | propTypes: {
|
38 | radius: PropTypes.number.isRequired,
|
39 | },
|
40 |
|
41 | render: function render() {
|
42 | var radius = this.props.radius;
|
43 |
|
44 | var path = Path()
|
45 | .moveTo(0, -radius)
|
46 | .arc(0, radius * 2, radius)
|
47 | .arc(0, radius * -2, radius)
|
48 | .close();
|
49 | return React.createElement(Shape, assign({}, this.props, {d: path}));
|
50 | },
|
51 | });
|
52 |
|
53 | module.exports = Circle;
|