import _extends from "babel-runtime/helpers/extends";
import _classCallCheck from "babel-runtime/helpers/classCallCheck";
import _createClass from "babel-runtime/helpers/createClass";
import _possibleConstructorReturn from "babel-runtime/helpers/possibleConstructorReturn";
import _inherits from "babel-runtime/helpers/inherits";
import React, { Component } from "react";
import AntdButton from "antd/es/button";
import PagePoint from "../page-point/pagePointEnhanced";
import { ConfigConsumer } from "../config-provider";
import "antd/es/button/style";
var Group = AntdButton.Group;

var Button = function (_Component) {
    _inherits(Button, _Component);

    function Button() {
        _classCallCheck(this, Button);

        return _possibleConstructorReturn(this, (Button.__proto__ || Object.getPrototypeOf(Button)).apply(this, arguments));
    }

    _createClass(Button, [{
        key: "render",
        value: function render() {
            var _this2 = this;

            var children = this.props.children;

            return React.createElement(
                ConfigConsumer,
                null,
                function (_ref) {
                    var pagePoint = _ref.pagePoint;
                    return pagePoint ? React.createElement(PagePoint, _extends({ compType: "Button" }, _this2.props, { render: function render(eventprops) {
                            return React.createElement(
                                AntdButton,
                                _extends({}, _this2.props, eventprops, { "data-ui-role": "Button" }),
                                children
                            );
                        } })) : React.createElement(
                        AntdButton,
                        _this2.props,
                        children
                    );
                }
            );
        }
    }]);

    return Button;
}(Component);

export default Button;

Button.Group = Group;