@adaptabletools/adaptable
Version:
Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
25 lines (24 loc) • 1.28 kB
JavaScript
import * as React from 'react';
import { Flex, Text } from 'rebass';
import { useAdaptable } from '../../../AdaptableContext';
import { AdaptableIconComponent } from '../../AdaptableIconComponent';
export const TopBar = (props) => {
const baseClassName = 'ab-Adaptable-Popup__TopBar';
const adaptable = 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, { iconClassName: iconClassName, icon: { name: 'settings' } });
}
else if (props.icon === 'ApplicationIcon' && applicationIcon) {
icon = React.createElement(AdaptableIconComponent, { icon: applicationIcon, iconClassName: iconClassName });
}
else if (typeof props.icon === 'object') {
icon = React.createElement(AdaptableIconComponent, { icon: props.icon, iconClassName: iconClassName });
}
return (React.createElement(Flex, { flex: 0, className: baseClassName },
icon,
React.createElement(Text, { className: `${baseClassName}__Title` }, props.children)));
};
export default TopBar;