Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add colored underlines to indicate collateral or borrows #830

Merged
merged 1 commit into from
Feb 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions earn/src/components/advanced/BorrowMetrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,16 @@ function getHealthColor(health: number) {
}
}

function MetricCard(props: { label: string; value: string }) {
const { label, value } = props;
function MetricCard(props: { label: string; value: string; valueClassName?: string }) {
const { label, value, valueClassName } = props;
return (
<MetricCardContainer>
<Text size='M' color={BORROW_TITLE_TEXT_COLOR}>
{label}
</Text>
<Display size='L'>{value}</Display>
<Display size='L' className={valueClassName}>
{value}
</Display>
</MetricCardContainer>
);
}
Expand Down Expand Up @@ -252,18 +254,22 @@ export function BorrowMetrics(props: BorrowMetricsProps) {
<MetricCard
label={`${marginAccount.token0.symbol} Collateral`}
value={formatTokenAmount(token0Collateral, 3)}
valueClassName='underline underline-offset-2 decoration-[#00C143f0]'
/>
<MetricCard
label={`${marginAccount.token1.symbol} Collateral`}
value={formatTokenAmount(token1Collateral, 3)}
valueClassName='underline underline-offset-2 decoration-[#00C143f0]'
/>
<MetricCard
label={`${marginAccount.token0.symbol} Borrows`}
value={formatTokenAmount(marginAccount.liabilities.amount0 || 0, 3)}
valueClassName='underline underline-offset-2 decoration-[#EC2D5Bf0]'
/>
<MetricCard
label={`${marginAccount.token1.symbol} Borrows`}
value={formatTokenAmount(marginAccount.liabilities.amount1 || 0, 3)}
valueClassName='underline underline-offset-2 decoration-[#EC2D5Bf0]'
/>
</MetricsGridUpper>
<MetricsGridLower>
Expand Down
Loading