Skip to content

Commit ab9d148

Browse files
committed
feat(v3-uplift): restyle no-search-results state & search input affordances
- NoSearchResults: two-text layout — H5 fg-max title (keyword appended in plain JS so it renders without waiting on i18n compilation) + fg-3 Paragraph description, 0.5rem gap, centered - consumers: trim the asset "no results" copy to a single sentence; add a proposals description to the governance list - SearchInput: swap the border for an outset shadow (figSurfaceShadow), and wrap the field in a <label> so clicking the search icon / padding focuses the input
1 parent f378b9d commit ab9d148

11 files changed

Lines changed: 54 additions & 59 deletions

File tree

src/components/NoSearchResults.tsx

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { t } from '@lingui/macro';
2-
import { Box, Typography, useMediaQuery, useTheme } from '@mui/material';
2+
import { Box, Typography } from '@mui/material';
33
import { ReactNode } from 'react';
44

55
type NoSearchResultsProps = {
@@ -8,40 +8,35 @@ type NoSearchResultsProps = {
88
};
99

1010
export const NoSearchResults: React.FC<NoSearchResultsProps> = ({ searchTerm, subtitle }) => {
11-
const { breakpoints } = useTheme();
12-
const sm = useMediaQuery(breakpoints.down('sm'));
13-
1411
return (
1512
<Box
1613
sx={{
1714
display: 'flex',
1815
flexDirection: 'column',
1916
alignItems: 'center',
20-
gap: 1,
17+
gap: '0.5rem',
18+
width: '100%',
2119
pt: 15,
2220
pb: 32,
2321
px: 4,
2422
}}
2523
>
26-
{sm ? (
27-
<Box sx={{ textAlign: 'center', maxWidth: '300px' }}>
28-
<Typography variant="h2">{t`No search results${searchTerm && ' for'}`}</Typography>
29-
{searchTerm && (
30-
<Typography sx={{ overflowWrap: 'anywhere' }} variant="h2">
31-
&apos;{searchTerm}&apos;
32-
</Typography>
33-
)}
34-
</Box>
35-
) : (
24+
{/* Title: H5, fg-max, centered; a long keyword ellipsizes rather than wrapping. */}
25+
<Typography variant="h5" color="fg-max" noWrap sx={{ textAlign: 'center', maxWidth: '100%' }}>
26+
{searchTerm ? t`No search results for` + ` '${searchTerm}'` : t`No search results`}
27+
</Typography>
28+
{/* Description: fg-3 "Paragraph" (0.875rem / 400 / 1.1875rem), supplied per search context. */}
29+
{subtitle && (
3630
<Typography
37-
sx={{ textAlign: 'center', maxWidth: '480px', overflowWrap: 'anywhere' }}
38-
variant="h2"
31+
variant="description"
32+
color="fg-3"
33+
sx={{
34+
textAlign: 'center',
35+
maxWidth: '280px',
36+
lineHeight: '1.1875rem',
37+
letterSpacing: 'normal',
38+
}}
3939
>
40-
{t`No search results${searchTerm && ` for \'${searchTerm}\'`}`}
41-
</Typography>
42-
)}
43-
{subtitle && (
44-
<Typography sx={{ width: '280px', textAlign: 'center' }} variant="description" color="fg-2">
4540
{subtitle}
4641
</Typography>
4742
)}

src/components/SearchInput.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Box, BoxProps, IconButton, InputBase, useMediaQuery, useTheme } from '@
33
import debounce from 'lodash/debounce';
44
import { useMemo, useRef, useState } from 'react';
55
import { SearchIcon } from 'src/components/icons/SearchIcon';
6-
import { figVars } from 'src/utils/figmaColors';
6+
import { figSurfaceShadow, figVars } from 'src/utils/figmaColors';
77

88
interface SearchInputProps {
99
onSearchTermChange: (value: string) => void;
@@ -37,14 +37,18 @@ export const SearchInput = ({
3737
}, [onSearchTermChange]);
3838
return (
3939
<Box
40+
component="label"
4041
sx={{
4142
display: 'flex',
4243
alignItems: 'center',
4344
gap: 2,
44-
border: `1px solid ${figVars['border-2']}`,
45+
boxShadow: figSurfaceShadow(),
4546
borderRadius: '0.5rem',
4647
height: '36px',
47-
// Focus ring: a 3px fg-3 outline held 2px off the border (replaces the prior no-op focus).
48+
// Wrapping <label> so clicking anywhere in the field (the search icon, the padding) focuses
49+
// the input, not just the input box itself.
50+
cursor: 'text',
51+
// Focus ring: a 3px fg-3 outline held 2px out (replaces the prior no-op focus).
4852
'&:focus-within': {
4953
outline: `3px solid ${figVars['fg-3']}`,
5054
outlineOffset: '2px',

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: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -968,6 +968,12 @@ msgstr "Protocol Incentives"
968968
msgid "Watch wallet"
969969
msgstr "Watch wallet"
970970

971+
#: src/modules/markets/MarketAssetsListContainer.tsx
972+
#: src/modules/umbrella/StakeAssets/UmbrellaAssetsListContainer.tsx
973+
#: src/modules/umbrella/UmbrellaAssetsDefault.tsx
974+
msgid "We couldn't find any assets related to your search."
975+
msgstr "We couldn't find any assets related to your search."
976+
971977
#: src/modules/migration/MigrationBottomPanel.tsx
972978
msgid "This action will reduce health factor of V3 below liquidation threshold. Increase migrated collateral or reduce migrated borrow to continue."
973979
msgstr "This action will reduce health factor of V3 below liquidation threshold. Increase migrated collateral or reduce migrated borrow to continue."
@@ -2516,12 +2522,6 @@ msgstr "Before supplying"
25162522
msgid "Liquidation value"
25172523
msgstr "Liquidation value"
25182524

2519-
#: src/modules/markets/MarketAssetsListContainer.tsx
2520-
#: src/modules/umbrella/StakeAssets/UmbrellaAssetsListContainer.tsx
2521-
#: src/modules/umbrella/UmbrellaAssetsDefault.tsx
2522-
msgid "We couldn't find any assets related to your search. Try again with a different asset name, symbol, or address."
2523-
msgstr "We couldn't find any assets related to your search. Try again with a different asset name, symbol, or address."
2524-
25252525
#: src/modules/history/actions/ActionDetails.tsx
25262526
msgid "enabled"
25272527
msgstr "enabled"
@@ -2774,6 +2774,10 @@ msgstr "Ltv validation failed"
27742774
msgid "Maximum amount available to supply is <0/> {0} (<1/>)."
27752775
msgstr "Maximum amount available to supply is <0/> {0} (<1/>)."
27762776

2777+
#: src/components/NoSearchResults.tsx
2778+
msgid "No search results for"
2779+
msgstr "No search results for"
2780+
27772781
#: src/components/transactions/Repay/RepayModalContent.tsx
27782782
msgid "You don’t have enough funds in your wallet to repay the full amount. If you proceed to repay with your current amount of funds, you will still have a small borrowing position in your dashboard."
27792783
msgstr "You don’t have enough funds in your wallet to repay the full amount. If you proceed to repay with your current amount of funds, you will still have a small borrowing position in your dashboard."
@@ -3964,6 +3968,10 @@ msgstr "Remove"
39643968
msgid "Auto Slippage"
39653969
msgstr "Auto Slippage"
39663970

3971+
#: src/components/NoSearchResults.tsx
3972+
msgid "No search results"
3973+
msgstr "No search results"
3974+
39673975
#: src/components/incentives/MeritIncentivesTooltipContent.tsx
39683976
msgid "Supply {0} and double your yield by <0><1>verifying your humanity through Self</1></0> for {1} per user."
39693977
msgstr "Supply {0} and double your yield by <0><1>verifying your humanity through Self</1></0> for {1} per user."
@@ -4026,11 +4034,6 @@ msgstr "Transaction failed"
40264034
msgid "Invalid flashloan premium"
40274035
msgstr "Invalid flashloan premium"
40284036

4029-
#: src/components/NoSearchResults.tsx
4030-
#: src/components/NoSearchResults.tsx
4031-
msgid "No search results{0}"
4032-
msgstr "No search results{0}"
4033-
40344037
#: src/modules/bridge/BridgeWrapper.tsx
40354038
msgid "Status"
40364039
msgstr "Status"
@@ -4150,6 +4153,10 @@ msgstr "Language"
41504153
msgid "Allows you to decide whether to use a supplied asset as collateral. An asset used as collateral will affect your borrowing power and health factor."
41514154
msgstr "Allows you to decide whether to use a supplied asset as collateral. An asset used as collateral will affect your borrowing power and health factor."
41524155

4156+
#: src/modules/governance/ProposalsV3List.tsx
4157+
msgid "We couldn't find any proposals related to your search."
4158+
msgstr "We couldn't find any proposals related to your search."
4159+
41534160
#: src/modules/governance/proposal/ProposalTimeline.tsx
41544161
#: src/modules/history/actions/ActionDetails.tsx
41554162
#: src/modules/history/actions/ActionDetails.tsx

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/governance/ProposalsV3List.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Trans } from '@lingui/macro';
12
import { Box, Paper, Skeleton, Stack, Typography } from '@mui/material';
23
import { useState } from 'react';
34
import InfiniteScroll from 'react-infinite-scroller';
@@ -202,7 +203,10 @@ export const ProposalsV3List = () => {
202203
) : ((!loadingSearchResults && searchTerm) ||
203204
(!loadingProposals && proposalFilter !== 'all')) &&
204205
listItems.length === 0 ? (
205-
<NoSearchResults searchTerm={searchTerm} />
206+
<NoSearchResults
207+
searchTerm={searchTerm}
208+
subtitle={<Trans>We couldn&apos;t find any proposals related to your search.</Trans>}
209+
/>
206210
) : (
207211
Array.from({ length: 4 }).map((_, i) => <ProposalListSkeleton key={i} />)
208212
)}

src/modules/markets/MarketAssetsListContainer.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -221,12 +221,7 @@ export const MarketAssetsListContainer = () => {
221221
{!loading && filteredData.length === 0 && !displayGhoBanner && (
222222
<NoSearchResults
223223
searchTerm={searchTerm}
224-
subtitle={
225-
<Trans>
226-
We couldn&apos;t find any assets related to your search. Try again with a different
227-
asset name, symbol, or address.
228-
</Trans>
229-
}
224+
subtitle={<Trans>We couldn&apos;t find any assets related to your search.</Trans>}
230225
/>
231226
)}
232227

src/modules/umbrella/StakeAssets/UmbrellaAssetsListContainer.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,7 @@ export const UmbrellaAssetsListContainer = () => {
8383
filteredData?.length === 0 && (
8484
<NoSearchResults
8585
searchTerm={searchTerm}
86-
subtitle={
87-
<Trans>
88-
We couldn&apos;t find any assets related to your search. Try again with a
89-
different asset name, symbol, or address.
90-
</Trans>
91-
}
86+
subtitle={<Trans>We couldn&apos;t find any assets related to your search.</Trans>}
9287
/>
9388
)
9489
)}

0 commit comments

Comments
 (0)