feat(trading): change to system monospace font (#4634)
This commit is contained in:
parent
287e294281
commit
3422b99491
@ -15,6 +15,10 @@ body,
|
|||||||
@apply h-full;
|
@apply h-full;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.font-mono {
|
||||||
|
@apply tracking-tighter;
|
||||||
|
}
|
||||||
|
|
||||||
.text-default {
|
.text-default {
|
||||||
@apply text-vega-clight-50 dark:text-vega-cdark-50;
|
@apply text-vega-clight-50 dark:text-vega-cdark-50;
|
||||||
}
|
}
|
||||||
@ -147,7 +151,7 @@ html [data-theme='dark'] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.vega-ag-grid .ag-header-row {
|
.vega-ag-grid .ag-header-row {
|
||||||
@apply font-alpha font-normal;
|
@apply font-normal font-alpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Light variables */
|
/* Light variables */
|
||||||
|
@ -1,8 +1,16 @@
|
|||||||
import { isNumeric } from '@vegaprotocol/utils';
|
import {
|
||||||
import { PriceChangeCell } from '@vegaprotocol/datagrid';
|
addDecimalsFormatNumber,
|
||||||
import { Tooltip } from '@vegaprotocol/ui-toolkit';
|
formatNumberPercentage,
|
||||||
|
isNumeric,
|
||||||
|
priceChange,
|
||||||
|
priceChangePercentage,
|
||||||
|
} from '@vegaprotocol/utils';
|
||||||
|
import { PriceChangeCell, signedNumberCssClass } from '@vegaprotocol/datagrid';
|
||||||
|
import { Tooltip, VegaIcon, VegaIconNames } from '@vegaprotocol/ui-toolkit';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/i18n';
|
||||||
import { useCandles } from '../../hooks/use-candles';
|
import { useCandles } from '../../hooks/use-candles';
|
||||||
|
import BigNumber from 'bignumber.js';
|
||||||
|
import classNames from 'classnames';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
marketId?: string;
|
marketId?: string;
|
||||||
@ -47,10 +55,39 @@ export const Last24hPriceChange = ({
|
|||||||
if (error || !isNumeric(decimalPlaces)) {
|
if (error || !isNumeric(decimalPlaces)) {
|
||||||
return <span>-</span>;
|
return <span>-</span>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const candles = oneDayCandles?.map((c) => c.close) || initialValue || [];
|
||||||
|
const change = priceChange(candles);
|
||||||
|
const changePercentage = priceChangePercentage(candles);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PriceChangeCell
|
<span
|
||||||
candles={oneDayCandles?.map((c) => c.close) || initialValue || []}
|
className={classNames(
|
||||||
decimalPlaces={decimalPlaces}
|
'flex items-center gap-1',
|
||||||
/>
|
signedNumberCssClass(change)
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<Arrow value={change} />
|
||||||
|
<span data-testid="price-change-percentage">
|
||||||
|
{formatNumberPercentage(new BigNumber(changePercentage.toString()), 2)}
|
||||||
|
</span>
|
||||||
|
<span data-testid="price-change">
|
||||||
|
{addDecimalsFormatNumber(change.toString(), decimalPlaces ?? 0, 3)}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const Arrow = ({ value }: { value: number | bigint }) => {
|
||||||
|
const size = 10;
|
||||||
|
|
||||||
|
if (value > 0) {
|
||||||
|
return <VegaIcon name={VegaIconNames.ARROW_UP} size={size} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value < 0) {
|
||||||
|
return <VegaIcon name={VegaIconNames.ARROW_DOWN} size={size} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
@ -177,7 +177,21 @@ module.exports = {
|
|||||||
success: '#00F780',
|
success: '#00F780',
|
||||||
},
|
},
|
||||||
fontFamily: {
|
fontFamily: {
|
||||||
mono: ['Roboto Mono', 'monospace'],
|
mono: [
|
||||||
|
'ui-monospace',
|
||||||
|
'Menlo',
|
||||||
|
'Monaco',
|
||||||
|
'Cascadia Mono',
|
||||||
|
'Segoe UI Mono',
|
||||||
|
'Roboto Mono',
|
||||||
|
'Oxygen Mono',
|
||||||
|
'Ubuntu Monospace',
|
||||||
|
'Source Code Pro',
|
||||||
|
'Fira Mono',
|
||||||
|
'Droid Sans Mono',
|
||||||
|
'Courier New',
|
||||||
|
'monospace',
|
||||||
|
],
|
||||||
sans: [
|
sans: [
|
||||||
'"Helvetica Neue", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',
|
'"Helvetica Neue", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',
|
||||||
],
|
],
|
||||||
|
Loading…
Reference in New Issue
Block a user