Skip to content

Commit 7a6c13d

Browse files
committed
feat(v3-uplift): restyle list-card Hide toggle as a labelled button + icon
- ListWrapper: replace the clickable box + CSS +/- bar with a text Button labelled 'Hide {collapseLabel}' / 'Show {collapseLabel}' with a MinusIcon suffix (fg-3), keeping the minus/plus collapse affordance. - Add a clean currentColor MinusIcon (from the Figma export). - Pass collapseLabel from the four dashboard cards: assets to supply, your supplies, assets to borrow, your borrows.
1 parent 29eaec2 commit 7a6c13d

11 files changed

Lines changed: 91 additions & 39 deletions

File tree

src/components/icons/MinusIcon.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { SvgIcon, SvgIconProps } from '@mui/material';
2+
3+
// Horizontal bar used as the collapse ("hide") control glyph. Strokes with `currentColor` so the
4+
// consumer sets the color. Cleaned from the Figma export (the stroke there was fg-3).
5+
export const MinusIcon = ({ sx, ...rest }: SvgIconProps) => (
6+
<SvgIcon viewBox="0 0 18 18" fill="none" sx={sx} {...rest}>
7+
<path
8+
d="M3.59961 9.03662H14.3996"
9+
stroke="currentColor"
10+
strokeWidth="1.35"
11+
strokeLinecap="round"
12+
strokeLinejoin="round"
13+
/>
14+
</SvgIcon>
15+
);

src/components/lists/ListWrapper.tsx

Lines changed: 40 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Trans } from '@lingui/macro';
2-
import { Box, BoxProps, Paper, PaperProps, Typography } from '@mui/material';
2+
import { Box, BoxProps, Button, Paper, PaperProps } from '@mui/material';
33
import { ReactNode, useState } from 'react';
4+
import { MinusIcon } from 'src/components/icons/MinusIcon';
45
import { useRootStore } from 'src/store/root';
56
import { DASHBOARD } from 'src/utils/events';
67

@@ -20,6 +21,8 @@ interface ListWrapperProps {
2021
paperSx?: PaperProps['sx'];
2122
topInfoSx?: BoxProps['sx'];
2223
onCollapseChange?: (collapsed: boolean) => void;
24+
/** What the card hides — renders the toggle as "Hide {collapseLabel}" / "Show {collapseLabel}". */
25+
collapseLabel?: string;
2326
}
2427

2528
export const ListWrapper = ({
@@ -36,6 +39,7 @@ export const ListWrapper = ({
3639
paperSx,
3740
topInfoSx,
3841
onCollapseChange,
42+
collapseLabel,
3943
}: ListWrapperProps) => {
4044
const [isCollapse, setIsCollapse] = useState(
4145
localStorageName ? localStorage.getItem(localStorageName) === 'true' : false
@@ -92,6 +96,18 @@ export const ListWrapper = ({
9296

9397
const collapsed = isCollapse && !noData;
9498

99+
const collapseText = collapsed ? (
100+
collapseLabel ? (
101+
<Trans>Show {collapseLabel}</Trans>
102+
) : (
103+
<Trans>Show</Trans>
104+
)
105+
) : collapseLabel ? (
106+
<Trans>Hide {collapseLabel}</Trans>
107+
) : (
108+
<Trans>Hide</Trans>
109+
);
110+
95111
return (
96112
<Paper
97113
variant="card"
@@ -124,31 +140,9 @@ export const ListWrapper = ({
124140
</Box>
125141

126142
{!!localStorageName && !noData && (
127-
<Box
128-
sx={{
129-
display: 'flex',
130-
alignItems: 'center',
131-
cursor: 'pointer',
132-
minHeight: '28px',
133-
pl: 3,
134-
span: {
135-
width: '14px',
136-
height: '2px',
137-
bgcolor: 'fg-2',
138-
position: 'relative',
139-
ml: 1,
140-
'&:after': {
141-
content: "''",
142-
position: 'absolute',
143-
width: '14px',
144-
height: '2px',
145-
bgcolor: 'fg-2',
146-
transition: 'all 0.2s ease',
147-
transform: collapsed ? 'rotate(90deg)' : 'rotate(0)',
148-
opacity: collapsed ? 1 : 0,
149-
},
150-
},
151-
}}
143+
<Button
144+
variant="text"
145+
size="small"
152146
onClick={() => {
153147
handleTrackingEvents();
154148

@@ -158,12 +152,27 @@ export const ListWrapper = ({
158152
onCollapseChange?.(nextIsCollapse);
159153
}
160154
}}
155+
endIcon={
156+
// − when expanded; a rotated copy fades in to form a + when collapsed.
157+
<Box sx={{ position: 'relative', display: 'inline-flex', color: 'fg-3' }}>
158+
<MinusIcon sx={{ fontSize: 18 }} />
159+
<MinusIcon
160+
sx={{
161+
fontSize: 18,
162+
position: 'absolute',
163+
top: 0,
164+
left: 0,
165+
transform: 'rotate(90deg)',
166+
opacity: collapsed ? 1 : 0,
167+
transition: 'opacity 0.2s ease',
168+
}}
169+
/>
170+
</Box>
171+
}
172+
sx={{ flexShrink: 0, ml: 3, color: 'fg-2' }}
161173
>
162-
<Typography variant="buttonM" color="fg-2">
163-
{collapsed ? <Trans>Show</Trans> : <Trans>Hide</Trans>}
164-
</Typography>
165-
<span />
166-
</Box>
174+
{collapseText}
175+
</Button>
167176
)}
168177
</Box>
169178

src/locales/el/messages.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/locales/en/messages.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/locales/en/messages.po

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -965,6 +965,10 @@ msgstr "Greek"
965965
msgid "Claim {symbol}"
966966
msgstr "Claim {symbol}"
967967

968+
#: src/modules/dashboard/lists/BorrowAssetsList/BorrowAssetsList.tsx
969+
msgid "assets to borrow"
970+
msgstr "assets to borrow"
971+
968972
#: src/components/transactions/Swap/errors/shared/FlashLoanDisabledBlockingError.tsx
969973
msgid "Position swaps are disabled for this asset due to security reasons."
970974
msgstr "Position swaps are disabled for this asset due to security reasons."
@@ -1441,6 +1445,10 @@ msgstr "Borrow balance after repay"
14411445
msgid "Supplied assets"
14421446
msgstr "Supplied assets"
14431447

1448+
#: src/components/lists/ListWrapper.tsx
1449+
msgid "Hide {collapseLabel}"
1450+
msgstr "Hide {collapseLabel}"
1451+
14441452
#: src/components/transactions/Warnings/DebtCeilingWarning.tsx
14451453
msgid "Protocol debt ceiling is at 100% for this asset. Further borrowing against this asset is unavailable."
14461454
msgstr "Protocol debt ceiling is at 100% for this asset. Further borrowing against this asset is unavailable."
@@ -2179,6 +2187,10 @@ msgstr "Details"
21792187
msgid "Stake cooldown activated"
21802188
msgstr "Stake cooldown activated"
21812189

2190+
#: src/modules/dashboard/lists/SupplyAssetsList/SupplyAssetsList.tsx
2191+
msgid "assets to supply"
2192+
msgstr "assets to supply"
2193+
21822194
#: src/components/transactions/Withdraw/WithdrawError.tsx
21832195
msgid "These funds have been borrowed and are not available for withdrawal at this time."
21842196
msgstr "These funds have been borrowed and are not available for withdrawal at this time."
@@ -3302,6 +3314,10 @@ msgstr "Select language"
33023314
msgid "<0>Attention:</0> Parameter changes via governance can alter your account health factor and risk of liquidation. Follow the <1>Aave governance forum</1> for updates."
33033315
msgstr "<0>Attention:</0> Parameter changes via governance can alter your account health factor and risk of liquidation. Follow the <1>Aave governance forum</1> for updates."
33043316

3317+
#: src/modules/dashboard/lists/SuppliedPositionsList/SuppliedPositionsList.tsx
3318+
msgid "your supplies"
3319+
msgstr "your supplies"
3320+
33053321
#: src/components/transactions/ClaimRewards/ClaimRewardsActions.tsx
33063322
msgid "Claim {0}"
33073323
msgstr "Claim {0}"
@@ -3495,6 +3511,14 @@ msgstr "No eligible assets to swap."
34953511
msgid "Depositing"
34963512
msgstr "Depositing"
34973513

3514+
#: src/components/lists/ListWrapper.tsx
3515+
msgid "Show {collapseLabel}"
3516+
msgstr "Show {collapseLabel}"
3517+
3518+
#: src/modules/dashboard/lists/BorrowedPositionsList/BorrowedPositionsList.tsx
3519+
msgid "your borrows"
3520+
msgstr "your borrows"
3521+
34983522
#: src/components/transactions/Swap/details/CollateralSwapDetails.tsx
34993523
msgid "Supply apy"
35003524
msgstr "Supply apy"

src/locales/es/messages.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/locales/fr/messages.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/modules/dashboard/lists/BorrowAssetsList/BorrowAssetsList.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { API_ETH_MOCK_ADDRESS } from '@aave/contract-helpers';
22
import { USD_DECIMALS, valueToBigNumber } from '@aave/math-utils';
3-
import { Trans } from '@lingui/macro';
3+
import { t, Trans } from '@lingui/macro';
44
import { Box, Typography, useMediaQuery, useTheme } from '@mui/material';
55
import { Fragment, useState } from 'react';
66
import { AssetCategoryMultiSelect } from 'src/components/AssetCategoryMultiselect';
@@ -235,6 +235,7 @@ export const BorrowAssetsList = () => {
235235
}
236236
onCollapseChange={setIsListCollapsed}
237237
localStorageName="borrowAssetsDashboardTableCollapse"
238+
collapseLabel={t`assets to borrow`}
238239
withTopMargin
239240
noData={borrowDisabled}
240241
subChildrenComponent={

src/modules/dashboard/lists/BorrowedPositionsList/BorrowedPositionsList.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { API_ETH_MOCK_ADDRESS, InterestRate } from '@aave/contract-helpers';
22
import { valueToBigNumber } from '@aave/math-utils';
3-
import { Trans } from '@lingui/macro';
3+
import { t, Trans } from '@lingui/macro';
44
import { Typography, useMediaQuery, useTheme } from '@mui/material';
55
import { useState } from 'react';
66
import { ListColumn } from 'src/components/lists/ListColumn';
@@ -150,6 +150,7 @@ export const BorrowedPositionsList = () => {
150150
</Typography>
151151
}
152152
localStorageName="borrowedAssetsDashboardTableCollapse"
153+
collapseLabel={t`your borrows`}
153154
subTitleComponent={
154155
showEModeButton ? (
155156
<DashboardEModeButton userEmodeCategoryId={user ? user.userEmodeCategoryId : 0} />

src/modules/dashboard/lists/SuppliedPositionsList/SuppliedPositionsList.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { API_ETH_MOCK_ADDRESS } from '@aave/contract-helpers';
2-
import { Trans } from '@lingui/macro';
2+
import { t, Trans } from '@lingui/macro';
33
import { Box, Typography, useMediaQuery, useTheme } from '@mui/material';
44
import { Fragment, useMemo, useState } from 'react';
55
import { ListColumn } from 'src/components/lists/ListColumn';
@@ -175,6 +175,7 @@ export const SuppliedPositionsList = () => {
175175
</Typography>
176176
}
177177
localStorageName="suppliedAssetsDashboardTableCollapse"
178+
collapseLabel={t`your supplies`}
178179
noData={!sortedReserves.length}
179180
subChildrenComponent={
180181
!!userHasSmallBalanceAssets && (

0 commit comments

Comments
 (0)