"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PanelWithButton = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const SimpleButton_1 = tslib_1.__importDefault(require("../../../components/SimpleButton"));
const Panel_1 = tslib_1.__importDefault(require("../../../components/Panel"));
const rebass_1 = require("rebass");
const icons_1 = require("../../../components/icons");
const ButtonInfo_1 = require("../Buttons/ButtonInfo");
const PanelWithButton = (props) => {
    const { buttonContent } = props;
    const IconCmp = icons_1.allIcons[props.glyphicon];
    const header = (React.createElement(rebass_1.Flex, { alignItems: "center", width: "100%" },
        React.createElement(rebass_1.Flex, { alignItems: "center" },
            props.glyphicon != null && (IconCmp ? React.createElement(IconCmp, null) : null),
            React.createElement(rebass_1.Box, { marginRight: 2, "data-name": "space-before" }),
            props.headerText,
            React.createElement(rebass_1.Box, { marginRight: 2, "data-name": "space-after" }),
            props.infoLink != null && !props.infoLinkDisabled && (React.createElement(ButtonInfo_1.ButtonInfo, { onClick: () => window.open(props.infoLink, '_blank') }))),
        React.createElement(rebass_1.Box, { style: { flex: 1 } }),
        buttonContent ? (React.createElement(SimpleButton_1.default, { variant: "raised", tone: "accent", disabled: props.buttonDisabled, onClick: () => (props.buttonClick ? props.buttonClick() : null) }, buttonContent)) : null,
        props.button ? React.cloneElement(props.button) : null));
    return (React.createElement(Panel_1.default, { flex: 1, className: props.className, bodyScroll: props.bodyScroll != null ? props.bodyScroll : true, bodyProps: props.bodyProps, variant: props.variant || 'primary', header: header, headerProps: props.headerProps, style: props.style, borderRadius: (props.borderRadius || 'none'), border: (props.border || 'none') }, props.children));
};
exports.PanelWithButton = PanelWithButton;
