Skip to content

Commit c92d195

Browse files
authored
[WALL] Lubega / WALL-5114 / Replace svg icon in cashier demo overlay (#17542)
* fix: replace icon in cashier demo overlay * fix: remove icon * fix: reduce icons array * fix: applied comments * fix: applied comments
1 parent ec0ca1e commit c92d195

File tree

5 files changed

+61
-20
lines changed

5 files changed

+61
-20
lines changed

packages/wallets/src/components/WalletGradientBackground/WalletGradientBackground.scss

+26-17
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,32 @@
2929
}
3030
}
3131

32+
&__icon-pattern {
33+
display: grid;
34+
grid-row-gap: 1.5rem;
35+
grid-template-columns: repeat(25, 1fr);
36+
position: absolute;
37+
overflow: hidden;
38+
inset: 0;
39+
40+
@include mobile {
41+
grid-row-gap: 1rem;
42+
grid-template-columns: repeat(20, 1fr);
43+
}
44+
45+
@include tablet-screen {
46+
--wallets-gradient-icon-gap: 0.5rem;
47+
grid-row-gap: calc(-1 * var(--wallets-gradient-icon-gap));
48+
grid-template-columns: repeat(20, 1fr);
49+
}
50+
}
51+
52+
&__icon {
53+
opacity: 0.24;
54+
mix-blend-mode: overlay;
55+
transform: rotate(-31deg);
56+
}
57+
3258
&[class*='desktop-header'],
3359
&[class*='mobile-header'] {
3460
border-radius: unset;
@@ -936,22 +962,5 @@
936962
}
937963
}
938964
}
939-
&-desktop-header-light,
940-
&-mobile-header-light,
941-
&-mobile-card-light {
942-
&:before {
943-
content: '';
944-
display: block;
945-
position: absolute;
946-
inset: 0;
947-
width: 100%;
948-
height: 100%;
949-
background-image: url('../../public/images/wallet-demo-bg-light.svg');
950-
background-repeat: repeat;
951-
background-size: 7rem;
952-
mix-blend-mode: overlay;
953-
opacity: 0.24;
954-
}
955-
}
956965
}
957966
}

packages/wallets/src/components/WalletGradientBackground/WalletGradientBackground.tsx

+19
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from 'react';
22
import classNames from 'classnames';
3+
import { PaymentMethodDerivDemoWhiteIcon } from '@deriv/quill-icons';
34
import { THooks } from '../../types';
45
import './WalletGradientBackground.scss';
56

@@ -34,13 +35,31 @@ const WalletGradientBackground: React.FC<TProps> = ({
3435
return `wallets-gradient--${gradientCurrencyClassName}-${device}-${type}-${theme}`;
3536
};
3637

38+
const IconWrapper = () => (
39+
<div className='wallets-gradient__icon-pattern'>
40+
{/* Array value represents the max number of visible icons for different screen sizes */}
41+
{/* 4 rows of 25 icons for desktop, 3 rows of 20 icons for mobile/tablet */}
42+
{[...Array(device === 'desktop' ? 100 : 60)].map((_, index) => (
43+
<PaymentMethodDerivDemoWhiteIcon
44+
className='wallets-gradient__icon'
45+
data-testid='dt_wallet_gradient_icon'
46+
key={index}
47+
width={70}
48+
/>
49+
))}
50+
</div>
51+
);
52+
3753
return (
3854
<div
3955
className={classNames(`wallets-gradient ${getClassName()}`, {
4056
[`${bodyClassName}`]: !!bodyClassName,
4157
})}
4258
data-testid='dt_wallet_gradient_background'
4359
>
60+
{isDemo && theme === 'light' && (type === 'header' || (device === 'mobile' && type === 'card')) && (
61+
<IconWrapper />
62+
)}
4463
{hasShine && !isDemo && <span className='wallets-gradient__shine' data-testid='dt_wallet_gradient_shine' />}
4564
<div className='wallets-gradient__content'>{children}</div>
4665
</div>

packages/wallets/src/components/WalletGradientBackground/__test__/WalletGradientBackground.spec.tsx

+14
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,20 @@ describe('WalletGradientBackground', () => {
6161
expect(screen.getByTestId('dt_wallet_gradient_background')).toHaveClass('custom-body-class');
6262
});
6363

64+
it('renders IconWrapper for desktop demo header with correct length', () => {
65+
render(
66+
<WalletGradientBackground {...defaultProps} device='desktop' isDemo={true} theme='light' type='header' />
67+
);
68+
expect(screen.getAllByTestId('dt_wallet_gradient_icon')).toHaveLength(100);
69+
});
70+
71+
it('renders IconWrapper for mobile demo header with correct length', () => {
72+
render(
73+
<WalletGradientBackground {...defaultProps} device='mobile' isDemo={true} theme='light' type='header' />
74+
);
75+
expect(screen.getAllByTestId('dt_wallet_gradient_icon')).toHaveLength(60);
76+
});
77+
6478
it('renders children correctly', () => {
6579
render(<WalletGradientBackground {...defaultProps} />);
6680
expect(screen.getByText('Test Content')).toBeInTheDocument();

packages/wallets/src/features/cashier/components/WalletCashierHeader/WalletCashierHeader.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ const getVirtualAccountTabs = () => {
7474
const WalletCashierHeader: React.FC<TProps> = ({ hideWalletDetails }) => {
7575
const { data: activeWallet } = useActiveWalletAccount();
7676
const { data: balanceData, isLoading: isBalanceLoading } = useAllBalanceSubscription();
77-
const { isDesktop, isMobile } = useDevice();
77+
const { isDesktop } = useDevice();
7878
const activeTabRef = useRef<HTMLButtonElement>(null);
7979
const history = useHistory();
8080
const location = useLocation();
@@ -92,7 +92,7 @@ const WalletCashierHeader: React.FC<TProps> = ({ hideWalletDetails }) => {
9292
return (
9393
<WalletGradientBackground
9494
currency={activeWallet?.currency}
95-
device={isMobile ? 'mobile' : 'desktop'}
95+
device={isDesktop ? 'desktop' : 'mobile'}
9696
isDemo={isDemo}
9797
theme='light'
9898
type='header'

packages/wallets/src/public/images/wallet-demo-bg-light.svg

-1
This file was deleted.

0 commit comments

Comments
 (0)