Skip to content

Commit ddde1c9

Browse files
fix: cell padding
1 parent c3a2705 commit ddde1c9

File tree

6 files changed

+19
-15
lines changed

6 files changed

+19
-15
lines changed

apps/main/src/llamalend/PageLlamaMarkets/cells/MarketTitleCell/MarketTitleCell.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { MouseEvent } from 'react'
22
import { LlamaMarket } from '@/llamalend/entities/llama-markets'
33
import { MarketBadges } from '@/llamalend/PageLlamaMarkets/cells/MarketTitleCell/MarketBadges'
4-
import Box from '@mui/material/Box'
54
import Stack from '@mui/material/Stack'
65
import Typography from '@mui/material/Typography'
76
import { CellContext } from '@tanstack/react-table'
@@ -17,14 +16,11 @@ import { UserPositionIndicator } from './UserPositionIndicator'
1716

1817
const { Spacing } = SizesAndSpaces
1918

20-
// the padding is removed from this cell, so we can show the indicator on the border, the spacer returns it back
21-
const PaddingSpacer = () => <Box sx={{ width: Spacing.md }} />
22-
2319
export const MarketTitleCell = ({ row: { original: market } }: CellContext<LlamaMarket, LlamaMarket['assets']>) => {
2420
const isMobile = useIsMobile()
2521
return (
2622
<Stack direction="row" gap={Spacing.sm} alignItems="center" sx={{ height: Sizing[700] }}>
27-
{market.userHasPosition ? <UserPositionIndicator market={market} /> : <PaddingSpacer />}
23+
{market.userHasPosition && <UserPositionIndicator market={market} />}
2824
<TokenPair
2925
chain={market.chain}
3026
assets={{ primary: market.assets.collateral, secondary: market.assets.borrowed }}

apps/main/src/llamalend/PageLlamaMarkets/cells/MarketTitleCell/UserPositionIndicator.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ import type { Theme } from '@mui/material/styles'
66
import { t } from '@ui-kit/lib/i18n'
77
import { LlamaIcon } from '@ui-kit/shared/icons/LlamaIcon'
88
import { Tooltip } from '@ui-kit/shared/ui/Tooltip'
9+
import { mapBreakpoints } from '@ui-kit/themes/basic-theme'
910
import { Duration } from '@ui-kit/themes/design/0_primitives'
1011
import { SizesAndSpaces } from '@ui-kit/themes/design/1_sizes_spaces'
1112
import { LlamaMarketColumnId } from '../../columns.enum'
1213

13-
const { IconSize } = SizesAndSpaces
14+
const { IconSize, Spacing } = SizesAndSpaces
1415

1516
type BackgroundColor = (theme: Theme) => string
1617
const info: BackgroundColor = (t) => t.design.Layer.Feedback.Info
@@ -48,7 +49,15 @@ export const UserPositionIndicator = ({ market }: { market: LlamaMarket }) => {
4849
: t`You have a position in this market`
4950
}
5051
>
51-
<Stack sx={{ backgroundColor, alignSelf: 'stretch', justifyContent: 'center' }}>
52+
<Stack
53+
sx={{
54+
backgroundColor,
55+
alignSelf: 'stretch',
56+
justifyContent: 'center',
57+
paddingInlineStart: mapBreakpoints(Spacing.md, (v) => `-${v}`), // negative padding to offset the padding of the cell
58+
paddingInlineEnd: Spacing.sm,
59+
}}
60+
>
5261
<LlamaIcon sx={{ color: (t) => t.design.Layer[1].Outline, width: IconSize.md, height: IconSize.md }} />
5362
</Stack>
5463
</Tooltip>

apps/main/src/llamalend/PageLlamaMarkets/columns.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ export const LLAMA_MARKET_COLUMNS = [
3333
header: t`Collateral • Borrow`,
3434
cell: MarketTitleCell,
3535
filterFn: filterByText,
36-
meta: { noPadding: true },
3736
}),
3837
columnHelper.display({
3938
id: LlamaMarketColumnId.UserHealth,

apps/main/src/llamalend/entities/llama-market-stats.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export function useUserMarketStats(market: LlamaMarket, column?: LlamaMarketColu
3939
return {
4040
...(stats && {
4141
data: {
42+
softLiquidation: stats.softLiquidation,
4243
isCollateralEroded: stats.softLiquidation && stats.debt > 0,
4344
health: stats.healthFull,
4445
borrowed: stats.debt,

packages/curve-ui-kit/src/shared/ui/DataTable/DataCell.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ export function getCellSx<T extends TableItem>({
1919
showCollapseIcon?: boolean
2020
isSticky: boolean
2121
}) {
22-
const { borderRight, noPadding } = column.columnDef.meta ?? {}
22+
const { borderRight } = column.columnDef.meta ?? {}
2323
// with the collapse icon there is an extra wrapper, so keep the sx separate
2424
const wrapperSx = {
2525
textAlign: getAlignment(column),
26-
...(!noPadding && { paddingInline: Spacing.sm }),
26+
paddingInline: Spacing.sm,
2727
}
2828
const sx = {
2929
...(!showCollapseIcon && wrapperSx),
30-
...(!noPadding && getExtraColumnPadding(column)),
30+
...getExtraColumnPadding(column),
3131
...((borderRight || isSticky) && { borderInlineEnd: (t: Theme) => `1px solid ${t.design.Layer[1].Outline}` }),
3232
...(isSticky && {
3333
position: 'sticky',

packages/curve-ui-kit/src/themes/basic-theme/basic-theme.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/// <reference path="./basic-theme.d.ts" />
2+
import { recordEntries } from '@curvefi/prices-api/objects.util'
23
import { Breakpoint } from '@mui/material'
34
import { createTheme as createMuiTheme } from '@mui/material/styles'
45
import { CSSObject } from '@mui/styled-engine'
@@ -61,8 +62,6 @@ export const handleBreakpoints = (values: Record<keyof CSSObject, number | strin
6162

6263
export const mapBreakpoints = (
6364
values: Responsive,
64-
callback: (value: string, breakpoint: Breakpoint) => CSSObject,
65+
callback: (value: string, breakpoint: Breakpoint) => string,
6566
): CSSObject =>
66-
Object.fromEntries(
67-
Object.entries(values).map(([breakpoint, value]) => [breakpoint, callback(value, breakpoint as Breakpoint)]),
68-
)
67+
Object.fromEntries(recordEntries(values).map(([breakpoint, value]) => [breakpoint, callback(value, breakpoint)]))

0 commit comments

Comments
 (0)