UNPKG

2.74 kBJavaScriptView Raw
1var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
2
3function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4
5function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
6
7function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
8
9import React from 'react';
10import PropTypes from 'prop-types';
11import { Icon } from 'cf-component-icon';
12import { createComponent } from 'cf-style-container';
13
14var ModalCloseWrapper = createComponent(function (_ref) {
15 var theme = _ref.theme;
16 return {
17 cursor: 'pointer',
18 right: theme.space[3],
19 top: theme.space[3],
20 position: 'absolute',
21 lineHeight: 0.6
22 };
23}, 'div', ['onClick']);
24ModalCloseWrapper.setDisplayName('ModalCloseWrapper');
25
26var ModalClose = function (_React$Component) {
27 _inherits(ModalClose, _React$Component);
28
29 function ModalClose() {
30 _classCallCheck(this, ModalClose);
31
32 return _possibleConstructorReturn(this, (ModalClose.__proto__ || Object.getPrototypeOf(ModalClose)).apply(this, arguments));
33 }
34
35 _createClass(ModalClose, [{
36 key: 'render',
37 value: function render() {
38 return React.createElement(
39 ModalCloseWrapper,
40 { onClick: this.props.onClick },
41 React.createElement(Icon, { type: 'remove', label: this.props.label })
42 );
43 }
44 }]);
45
46 return ModalClose;
47}(React.Component);
48
49ModalClose.propTypes = {
50 onClick: PropTypes.func.isRequired,
51 label: PropTypes.oneOfType([PropTypes.string, PropTypes.bool])
52};
53
54ModalClose.defaultProps = {
55 label: false
56};
57
58export default ModalClose;
\No newline at end of file