@adaptabletools/adaptable
Version:
Powerful AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
24 lines (23 loc) • 1.83 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
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';
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 = (_jsx(Flex, { className: "twa:flex-1", children: _jsxs(Flex, { alignItems: "center", children: [_jsxs(Flex, { className: "twa:min-h-[15px]", alignItems: "center", style: headerStyle, children: [IconCmp ? _jsx(IconCmp, {}) : null, _jsx(Box, { className: "twa:mr-2" }), this.props.header ?? '', _jsx(Box, { className: "twa:mr-2", "data-name": "space-after" }), this.props.infoLink != null && !this.props.infoLinkDisabled && (_jsx(ButtonInfo, { onClick: () => window.open(this.props.infoLink, '_blank') }))] }), _jsx(Flex, { className: "twa:flex-1" }), this.props.button && React.cloneElement(this.props.button)] }) }));
return (_jsx(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),
}, children: this.props.children }));
}
}
export const PanelWithImage = PanelWithImageCmp;