Skip to content

Commit 6a87101

Browse files
committed
fix(suite): fix clipped HiddenPlaceholder blur
1 parent 8f4c677 commit 6a87101

File tree

4 files changed

+25
-15
lines changed

4 files changed

+25
-15
lines changed

packages/suite/src/components/suite/layouts/SuiteLayout/SubpageNavigation.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const Container = styled.div`
1515
top: ${HEADER_HEIGHT};
1616
background: ${({ theme }) => theme.backgroundSurfaceElevation0};
1717
border-bottom: 1px solid ${({ theme }) => theme.borderElevation1};
18-
z-index: ${zIndices.pageHeader};
18+
z-index: ${zIndices.stickyBar};
1919
width: 100%;
2020
padding: ${spacingsPx.md} ${spacingsPx.md} 0;
2121
`;

packages/suite/src/components/wallet/WalletLayout/AccountTopPanel/AccountTopPanel.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { forwardRef } from 'react';
22

33
import styled from 'styled-components';
44

5-
import { spacingsPx } from '@trezor/theme';
5+
import { spacingsPx, zIndices } from '@trezor/theme';
66
import { NetworkSymbol } from '@suite-common/wallet-config';
77
import { SkeletonCircle, SkeletonRectangle } from '@trezor/components';
88
import { CoinLogo } from '@trezor/product-components';
@@ -23,6 +23,7 @@ const Container = styled.div`
2323
padding-left: ${spacingsPx.md};
2424
padding-right: ${spacingsPx.md};
2525
margin-top: ${spacingsPx.lg};
26+
z-index: ${zIndices.pageSubHeader};
2627
`;
2728

2829
const AccountCryptoBalance = styled.div`

packages/suite/src/components/wallet/WalletLayout/AccountsMenu/AccountItem/AccountItemContent.tsx

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,19 @@ import {
1313
} from '@trezor/components';
1414
import { isTestnet } from '@suite-common/wallet-utils';
1515

16-
import { useLoadingSkeleton, useSelector } from '../../../../../hooks/suite';
17-
import { selectLocalCurrency } from '../../../../../reducers/wallet/settingsReducer';
16+
import { useLoadingSkeleton, useSelector } from 'src/hooks/suite';
17+
import {
18+
selectIsDiscreteModeActive,
19+
selectLocalCurrency,
20+
} from 'src/reducers/wallet/settingsReducer';
1821
import {
1922
AccountLabel,
2023
CoinBalance,
2124
FiatValue,
2225
HiddenPlaceholder,
2326
Translation,
24-
} from '../../../../suite';
25-
import { AccountItemType } from '../../../../../types/wallet';
27+
} from 'src/components/suite';
28+
import { AccountItemType } from 'src/types/wallet';
2629

2730
const AccountLabelContainer = styled.div`
2831
flex: 1;
@@ -32,6 +35,7 @@ const AccountLabelContainer = styled.div`
3235
text-overflow: ellipsis;
3336
white-space: nowrap;
3437
`;
38+
3539
type ItemContentProps = {
3640
customFiatValue?: string;
3741
account: Account;
@@ -43,6 +47,14 @@ type ItemContentProps = {
4347
formattedBalance: string;
4448
dataTestKey?: string;
4549
};
50+
51+
const FiatValueRenderComponent = ({ value }: { value: JSX.Element | null }) => {
52+
const discreetMode = useSelector(selectIsDiscreteModeActive);
53+
if (discreetMode || value === null) return value;
54+
55+
return <TruncateWithTooltip delayShow={TOOLTIP_DELAY_LONG}>{value}</TruncateWithTooltip>;
56+
};
57+
4658
export const AccountItemContent = ({
4759
customFiatValue,
4860
account,
@@ -56,12 +68,14 @@ export const AccountItemContent = ({
5668
}: ItemContentProps) => {
5769
const { FiatAmountFormatter } = useFormatters();
5870
const localCurrency = useSelector(selectLocalCurrency);
71+
const discreetMode = useSelector(selectIsDiscreteModeActive);
5972
const { shouldAnimate } = useLoadingSkeleton();
6073

6174
const isBalanceShown = account.backendType !== 'coinjoin' || account.status !== 'initial';
6275

6376
return (
64-
<Column flex="1" overflow="hidden" gap={spacings.xxxs}>
77+
// content is constant size in discreet mode, so overflow: hidden is unnecessary. Though it would cut off CSS blur effect, so we may turn it off
78+
<Column flex="1" overflow={discreetMode ? 'visible' : 'hidden'} gap={spacings.xxxs}>
6579
<Row gap={spacings.md} margin={{ right: spacings.xxs }} justifyContent="space-between">
6680
<AccountLabelContainer data-testid={`${dataTestKey}/label`}>
6781
{type === 'coin' && (
@@ -93,13 +107,7 @@ export const AccountItemContent = ({
93107
maximumFractionDigits: 0,
94108
}}
95109
>
96-
{({ value }) =>
97-
value ? (
98-
<TruncateWithTooltip delayShow={TOOLTIP_DELAY_LONG}>
99-
{value}
100-
</TruncateWithTooltip>
101-
) : null
102-
}
110+
{FiatValueRenderComponent}
103111
</FiatValue>
104112
)}
105113
</Row>

packages/theme/src/zIndices.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ export const zIndices = {
1717
navigationBar: 30,
1818
expandableNavigationHeader: 21, // above EXPANDABLE_NAVIGATION to cover its box-shadow
1919
expandableNavigation: 20, // above PAGE_HEADER to spread over it
20-
pageHeader: 11, // above STICKY_BAR to hide it when the page is on top
20+
pageHeader: 12, // above STICKY_BAR to hide it when the page is on top
21+
pageSubHeader: 11, // below PAGE_HEADER to be hidden beneath it, but above STICKY_BAR
2122
stickyBar: 10, // above page content to scroll over it
2223
secondaryStickyBar: 9, // below STICKY_BAR so that it can hide beneath it when no longer needed
2324
selectMenu: 3,

0 commit comments

Comments
 (0)