"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TopBar = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const rebass_1 = require("rebass");
const AdaptableContext_1 = require("../../../AdaptableContext");
const AdaptableIconComponent_1 = require("../../AdaptableIconComponent");
const TopBar = (props) => {
    const baseClassName = 'ab-Adaptable-Popup__TopBar';
    const adaptable = (0, AdaptableContext_1.useAdaptable)();
    const applicationIcon = adaptable.api.optionsApi.getUserInterfaceOptions()?.applicationIcon;
    let icon = React.createElement(React.Fragment, null);
    const iconClassName = `${baseClassName}__Icon`;
    if (props.icon === 'ConfigurationIcon') {
        icon = React.createElement(AdaptableIconComponent_1.AdaptableIconComponent, { iconClassName: iconClassName, icon: { name: 'settings' } });
    }
    else if (props.icon === 'ApplicationIcon' && applicationIcon) {
        icon = React.createElement(AdaptableIconComponent_1.AdaptableIconComponent, { icon: applicationIcon, iconClassName: iconClassName });
    }
    else if (typeof props.icon === 'object') {
        icon = React.createElement(AdaptableIconComponent_1.AdaptableIconComponent, { icon: props.icon, iconClassName: iconClassName });
    }
    return (React.createElement(rebass_1.Flex, { flex: 0, className: baseClassName },
        icon,
        React.createElement(rebass_1.Text, { className: `${baseClassName}__Title` }, props.children)));
};
exports.TopBar = TopBar;
exports.default = exports.TopBar;
