import * as React from 'react';
import NewPanel from '../../../components/Panel';
import { allIcons } from '../../../components/icons';
import { ButtonInfo } from '../Buttons/ButtonInfo';
import { twMerge } from '../../../twMerge';
import { Box, Flex } from '../../../components/Flex';
//We cannot destructure this.props using the react way in typescript which is a real pain as you
//need to transfer props individually as a consequence
//let { buttonContent, ...other } = this.props
class PanelWithImageCmp extends React.Component {
    render() {
        const IconCmp = allIcons[(this.props.icon || this.props.glyphicon)];
        const headerStyle = {};
        if (this.props.headerColor) {
            headerStyle.color = this.props.headerColor;
            headerStyle.fill = this.props.headerColor;
        }
        let headerRow = (React.createElement(Flex, { className: "twa:flex-1" },
            React.createElement(Flex, { alignItems: "center" },
                React.createElement(Flex, { className: "twa:min-h-[15px]", alignItems: "center", style: headerStyle },
                    IconCmp ? React.createElement(IconCmp, null) : null,
                    React.createElement(Box, { className: "twa:mr-2" }),
                    this.props.header ?? '',
                    React.createElement(Box, { className: "twa:mr-2", "data-name": "space-after" }),
                    this.props.infoLink != null && !this.props.infoLinkDisabled && (React.createElement(ButtonInfo, { onClick: () => window.open(this.props.infoLink, '_blank' // <- opens the link in a new tab or window.
                        ) }))),
                React.createElement(Flex, { className: "twa:flex-1" }),
                this.props.button && React.cloneElement(this.props.button))));
        return (React.createElement(NewPanel, { header: headerRow, variant: this.props.variant, style: this.props.style, bodyScroll: this.props.bodyScroll !== undefined ? this.props.bodyScroll : true, className: twMerge('twa:rounded-none twa:border-none', this.props.className), bodyProps: {
                ...this.props.bodyProps,
                className: twMerge('twa:p-0', this.props.bodyProps?.className),
            } }, this.props.children));
    }
}
export const PanelWithImage = PanelWithImageCmp;
