@adaptabletools/adaptable
Version:
Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
21 lines (20 loc) • 828 B
JavaScript
import * as React from 'react';
import { Box, Flex } from 'rebass';
const getText = (options) => {
let text = '';
if (options && options.includes('CellValue')) {
text += '20';
}
if (options && options.includes('PercentageValue')) {
text += ' (50%)';
}
return text.trim();
};
export const PercentBarStylePreview = (props) => {
const cellText = getText(props.cellText);
const tooltip = getText(props.toolTipText);
return (React.createElement(Box, { title: tooltip, flex: 1 },
React.createElement(Flex, { height: cellText ? 8 : 18, backgroundColor: props.backgroundColor, flex: 1 },
React.createElement(Box, { flexBasis: "50%", style: { background: props.barBackgroundColor } })),
cellText && React.createElement(Box, { fontSize: 3 }, cellText)));
};