You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dashboard/src/components/Data.jsx

18 lines
557 B
React

import { Tag } from 'antd';
import { CaretUpOutlined, CaretDownOutlined } from '@ant-design/icons';
export const VSTag = (diffPercent, diffData, data1, data2) => {
const CaretIcon = parseInt(diffPercent) < 0 ? CaretDownOutlined : CaretUpOutlined;
const tagColor = parseInt(diffPercent) < 0 ? "gold" : "lime";
return parseInt(diffPercent) === 0 ? "-" : (
<span>
<div>
{data1} vs {data2}
</div>
<Tag icon={<CaretIcon />} color={tagColor}>
{diffPercent} {diffData}
</Tag>
</span>
);
};