react-hold
Version:
Hold the empty presentational components in react.js
49 lines (44 loc) • 1.3 kB
JavaScript
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
import React from 'react';
import PropTypes from 'prop-types';
import shapes from '../shapes';
import Square from './Square';
import { CENTER } from '../align';
var Circle = function Circle(_ref) {
var color = _ref.color,
width = _ref.width,
height = _ref.height,
children = _ref.children,
diameter = _ref.diameter,
align = _ref.align,
fillerStyle = _ref.fillerStyle;
return React.createElement(
Square,
{ color: 'transparent', width: width, height: height, side: diameter, align: align },
React.createElement(
'div',
{
style: _extends({
background: color
}, fillerStyle, {
width: '100%',
height: '100%',
borderRadius: '50%'
})
},
children
)
);
};
Circle.propTypes = _extends({}, shapes, {
diameter: Square.propTypes.side,
align: PropTypes.string
});
Circle.defaultProps = {
width: null,
height: null,
diameter: null,
align: CENTER,
fillerStyle: null
};
export default Circle;