@adaptabletools/adaptable
Version:
Powerful AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
15 lines (14 loc) • 1.67 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import * as React from 'react';
import SimpleButton from '../../../components/SimpleButton';
import Panel from '../../../components/Panel';
import { allIcons } from '../../../components/icons';
import { ButtonInfo } from '../Buttons/ButtonInfo';
import { twMerge } from 'tailwind-merge';
import { Box, Flex } from '../../../components/Flex';
export const PanelWithButton = (props) => {
const { buttonContent } = props;
const IconCmp = allIcons[props.glyphicon];
const header = (_jsxs(Flex, { alignItems: "center", className: "twa:w-full", children: [_jsxs(Flex, { alignItems: "center", children: [props.glyphicon != null && (IconCmp ? _jsx(IconCmp, {}) : null), _jsx(Box, { "data-name": "space-before", className: "twa:mr-2" }), props.headerText, _jsx(Box, { "data-name": "space-after", className: "twa:mr-2" }), props.infoLink != null && !props.infoLinkDisabled && (_jsx(ButtonInfo, { onClick: () => window.open(props.infoLink, '_blank') }))] }), _jsx(Box, { className: "twa:flex-1" }), buttonContent ? (_jsx(SimpleButton, { variant: "raised", tone: "accent", disabled: props.buttonDisabled, onClick: () => (props.buttonClick ? props.buttonClick() : null), children: buttonContent })) : null, props.button ? React.cloneElement(props.button) : null] }));
return (_jsx(Panel, { className: twMerge('twa:flex-1 twa:rounded-none twa:border-none', props.className), bodyScroll: props.bodyScroll != null ? props.bodyScroll : true, bodyProps: props.bodyProps, variant: props.variant || 'primary', header: header, headerProps: props.headerProps, style: props.style, children: props.children }));
};