vega-frontend-monorepo/apps/trading/components/fees-container/stat.tsx

35 lines
800 B
TypeScript
Raw Normal View History

import { Tooltip } from '@vegaprotocol/ui-toolkit';
2023-10-25 21:59:30 +00:00
import classNames from 'classnames';
import type { ReactNode } from 'react';
2023-10-25 21:59:30 +00:00
export const Stat = ({
value,
text,
highlight,
description,
2023-10-25 21:59:30 +00:00
}: {
value: string | number;
text?: string;
highlight?: boolean;
description?: ReactNode;
2023-10-25 21:59:30 +00:00
}) => {
const val = (
<span
className={classNames('inline-block text-3xl leading-none', {
'text-transparent bg-rainbow bg-clip-text': highlight,
'cursor-help': description,
})}
>
{value}
</span>
);
2023-10-25 21:59:30 +00:00
return (
<p className="pt-3 leading-none first:pt-6">
{description ? <Tooltip description={description}>{val}</Tooltip> : val}
2023-10-25 21:59:30 +00:00
{text && (
<small className="block mt-0.5 text-xs text-muted">{text}</small>
)}
</p>
);
};