Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WALL] Jim/WALL-4349/replace walletbutton with button #16146

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/account/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@deriv-com/analytics": "1.10.0",
"@deriv-com/translations": "1.3.4",
"@deriv-com/utils": "^0.0.25",
"@deriv-com/ui": "1.29.7",
"@deriv-com/ui": "1.29.9",
"@deriv/api": "^1.0.0",
"@deriv-com/quill-ui": "1.13.17",
"@deriv/components": "^1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/cashier-v2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"start": "rimraf dist && npm run test && npm run serve"
},
"dependencies": {
"@deriv-com/ui": "1.29.7",
"@deriv-com/ui": "1.29.9",
"@deriv-com/utils": "^0.0.25",
"@deriv/api-v2": "^1.0.0",
"@deriv/integration": "^1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/cfd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
},
"dependencies": {
"@deriv-com/analytics": "1.10.0",
"@deriv-com/ui": "1.29.7",
"@deriv-com/ui": "1.29.9",
"@deriv-com/translations": "1.3.4",
"@deriv-com/utils": "^0.0.25",
"@deriv/account": "^1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
},
"dependencies": {
"@contentpass/zxcvbn": "^4.4.3",
"@deriv-com/ui": "1.29.7",
"@deriv-com/ui": "1.29.9",
"@deriv/shared": "^1.0.0",
"@deriv/stores": "^1.0.0",
"@deriv/translations": "^1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
"@deriv-com/quill-tokens": "^2.0.4",
"@deriv-com/quill-ui": "1.13.17",
"@deriv-com/translations": "1.3.4",
"@deriv-com/ui": "1.29.7",
"@deriv-com/ui": "1.29.9",
"@deriv-com/utils": "^0.0.25",
"@deriv/account": "^1.0.0",
"@deriv/api": "^1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/reports/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
},
"dependencies": {
"@deriv-com/analytics": "1.10.0",
"@deriv-com/ui": "1.29.7",
"@deriv-com/ui": "1.29.9",
"@deriv/components": "^1.0.0",
"@deriv/deriv-api": "^1.0.15",
"@deriv/api-types": "1.0.172",
Expand Down
2 changes: 1 addition & 1 deletion packages/trader/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"@deriv-com/quill-tokens": "^2.0.4",
"@deriv-com/quill-ui": "1.13.17",
"@deriv-com/utils": "^0.0.25",
"@deriv-com/ui": "1.29.7",
"@deriv-com/ui": "1.29.9",
"@deriv/api-types": "1.0.172",
"@deriv/components": "^1.0.0",
"@deriv/deriv-api": "^1.0.15",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ test.describe('Wallets - Crypto withdrawal', () => {
// #fiatAmount
await expect(page.locator('#fiatAmount')).toBeVisible();

// button of type "submit" with text "Withdraw" and with class .wallets-button
const submitButton = await page.locator('button.wallets-button[type="submit"]');
// button of type "submit" with text "Withdraw" and with class .deriv-button
const submitButton = await page.locator('button.deriv-button[type="submit"]');
await expect(submitButton).toBeVisible();
await expect(submitButton).toHaveText('Withdraw');
});
Expand Down
2 changes: 1 addition & 1 deletion packages/wallets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
"dependencies": {
"@deriv-com/analytics": "1.10.0",
"@deriv-com/ui": "1.29.7",
"@deriv-com/ui": "1.29.9",
"@deriv-com/utils": "^0.0.25",
"@deriv/api-v2": "^1.0.0",
"@deriv/integration": "^1.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { ComponentProps } from 'react';
import { WalletButton } from '../Base';
import { Button } from '@deriv-com/ui';
import { WalletsActionScreen } from '../WalletsActionScreen';
import './WalletsErrorScreen.scss';

type TProps = {
buttonText?: string;
buttonVariant?: ComponentProps<typeof WalletButton>['variant'];
buttonVariant?: ComponentProps<typeof Button>['variant'];
message?: string;
onClick?: () => void;
title?: string;
Expand All @@ -24,9 +24,9 @@ const WalletsErrorScreen: React.FC<TProps> = ({
description={message}
renderButtons={() =>
buttonText ? (
<WalletButton onClick={onClick} size='lg' variant={buttonVariant}>
<Button borderWidth='sm' onClick={onClick} size='lg' textSize='md' variant={buttonVariant}>
{buttonText}
</WalletButton>
</Button>
) : null
}
title={title}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import { ModalWrapper, WalletButton, WalletText } from '../../../../components/Base';
import { Button } from '@deriv-com/ui';
import { ModalWrapper, WalletText } from '../../../../components/Base';
import useDevice from '../../../../hooks/useDevice';
import './WalletActionModal.scss';

Expand Down Expand Up @@ -34,14 +35,17 @@ const WalletActionModal: React.FC<TWalletActionModal> = ({
{!!actionButtonsOptions.length && (
<div className='wallets-action-modal__buttons-container'>
{actionButtonsOptions.map(action => (
<WalletButton
<Button
borderWidth='sm'
color={action.isPrimary ? 'primary' : 'black'}
key={action.text}
onClick={action.onClick}
size='lg'
textSize='md'
variant={action.isPrimary ? 'contained' : 'outlined'}
>
{action.text}
</WalletButton>
</Button>
))}
</div>
)}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React, { useState } from 'react';
import { useHistory } from 'react-router-dom';
import { LegacyArrowLeft2pxIcon } from '@deriv/quill-icons';
import { WalletButton, WalletText } from '../../../../components';
import { Button } from '@deriv-com/ui';
import { WalletText } from '../../../../components';
import { FiatOnRampDisclaimer, FiatOnRampProviderCard } from './components';
import { fiatOnRampProvider } from './constants';
import './FiatOnRamp.scss';
Expand All @@ -19,13 +20,13 @@ const FiatOnRamp = () => {
) : (
<div className='wallets-fiat-onramp'>
<div className='wallets-fiat-onramp__actions'>
<WalletButton
<Button
color='white'
icon={<LegacyArrowLeft2pxIcon iconSize='xs' />}
onClick={() => history.push('/wallet/deposit')}
>
Back
</WalletButton>
</Button>
</div>
<div className='wallets-fiat-onramp__content'>
<div className='wallets-fiat-onramp__description'>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { MouseEventHandler, useCallback, useEffect } from 'react';
import { useMutation } from '@deriv/api-v2';
import { WalletButton, WalletText } from '../../../../../../components';
import { Button } from '@deriv-com/ui';
import { WalletText } from '../../../../../../components';
import './FiatOnRampDisclaimer.scss';

type TFiatOnRampDisclaimer = {
Expand Down Expand Up @@ -32,12 +33,12 @@ const FiatOnRampDisclaimer: React.FC<TFiatOnRampDisclaimer> = ({ handleDisclaime
you encounter any issues related to Banxa services, you should contact Banxa directly.
</WalletText>
<div className='wallets-fiat-onramp-disclaimer__buttons'>
<WalletButton color='white' onClick={handleDisclaimer} size='md' variant='outlined'>
<Button borderWidth='sm' color='black' onClick={handleDisclaimer} size='md' variant='outlined'>
Back
</WalletButton>
<WalletButton isLoading={isLoading} onClick={() => redirectToBanxa()} size='md'>
</Button>
<Button borderWidth='sm' isLoading={isLoading} onClick={() => redirectToBanxa()} size='md'>
Continue
</WalletButton>
</Button>
</div>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ jest.mock('@deriv/api-v2', () => ({
}));
const mockUseMutation = useMutation as jest.Mock;

jest.mock('@deriv-com/ui', () => ({
Loader: jest.fn(() => <div>Loading...</div>),
}));

describe('FiatOnRampDisclaimer', () => {
beforeEach(() => {
mockUseMutation.mockReturnValue({
Expand Down Expand Up @@ -46,7 +42,7 @@ describe('FiatOnRampDisclaimer', () => {
const handleDisclaimer = jest.fn();

render(<FiatOnRampDisclaimer handleDisclaimer={handleDisclaimer} />);
expect(screen.getByText('Loading...')).toBeInTheDocument();
expect(screen.getByTestId('dt_derivs-loader')).toBeInTheDocument();
});

it('should call handleDisclaimer function on "Back" button click', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { MouseEventHandler } from 'react';
import { WalletButton, WalletText } from '../../../../../../components';
import { Button } from '@deriv-com/ui';
import { WalletText } from '../../../../../../components';
import './FiatOnRampProviderCard.scss';

type TFiatOnRampProvider = {
Expand Down Expand Up @@ -48,9 +49,9 @@ const FiatOnRampProviderCard: React.FC<TFiatOnRampProvider> = ({
</div>
))}
</div>
<WalletButton onClick={handleDisclaimer} size='md'>
<Button borderWidth='sm' onClick={handleDisclaimer} size='md'>
Select
</WalletButton>
</Button>
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React from 'react';
import { useHistory } from 'react-router-dom';
import { useMutation } from '@deriv/api-v2';
import { WalletButton, WalletsActionScreen } from '../../../../components';
import { Button } from '@deriv-com/ui';
import { WalletsActionScreen } from '../../../../components';
//TODO: replace with quill-icons
import IcResetDemoBalance from '../../../../public/images/ic-demo-reset-balance.svg';
import IcResetDemoBalanceDone from '../../../../public/images/ic-demo-reset-balance-done.svg';
Expand All @@ -22,12 +23,14 @@ const ResetBalance = () => {
}
icon={isResetBalanceSuccess ? <IcResetDemoBalanceDone /> : <IcResetDemoBalance />}
renderButtons={() => (
<WalletButton
<Button
borderWidth='sm'
onClick={isResetBalanceSuccess ? () => history.push('/wallet/account-transfer') : resetBalance}
size='lg'
textSize='md'
>
{isResetBalanceSuccess ? 'Transfer funds' : 'Reset balance'}
</WalletButton>
</Button>
)}
title={isResetBalanceSuccess ? 'Success' : 'Reset balance'}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import classNames from 'classnames';
import moment from 'moment';
import { useCancelCryptoTransaction } from '@deriv/api-v2';
import { LegacyClose1pxIcon } from '@deriv/quill-icons';
import { WalletButton, WalletText } from '../../../../../../components/Base';
import { Button } from '@deriv-com/ui';
import { WalletText } from '../../../../../../components/Base';
import { useModal } from '../../../../../../components/ModalProvider';
import useDevice from '../../../../../../hooks/useDevice';
import { THooks } from '../../../../../../types';
Expand Down Expand Up @@ -133,14 +134,16 @@ const CryptoTransaction: React.FC<TCryptoTransaction> = ({
)}
{!!transaction.is_valid_to_cancel && isMobile && (
<div className='wallets-crypto-transaction__cancel-button-container'>
<WalletButton
<Button
borderWidth='sm'
color='black'
data-testid='dt-wallets-crypto-transactions-cancel-button'
onClick={onCancelTransactionButtonClick}
size='sm'
variant='outlined'
>
Cancel transaction
</WalletButton>
</Button>
</div>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Divider } from '@deriv-com/ui';
import { WalletButton, WalletText } from '../../../../../../components/Base';
import { Button, Divider } from '@deriv-com/ui';
import { WalletText } from '../../../../../../components/Base';

type TTransactionStatusError = {
refresh: VoidFunction;
Expand All @@ -12,9 +12,9 @@ const TransactionStatusError: React.FC<TTransactionStatusError> = ({ refresh })
Unfortunately, we cannot retrieve the information at this time.
</WalletText>
<Divider color='var(--general-active)' />
<WalletButton isFullWidth={true} onClick={refresh} size='sm' variant='outlined'>
<Button borderWidth='sm' color='black' isFullWidth={true} onClick={refresh} size='sm' variant='outlined'>
Refresh
</WalletButton>
</Button>
</React.Fragment>
);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { useHistory } from 'react-router-dom';
import { Divider } from '@deriv-com/ui';
import { WalletButton, WalletText } from '../../../../../../components/Base';
import { Button, Divider } from '@deriv-com/ui';
import { WalletText } from '../../../../../../components/Base';
import { THooks } from '../../../../../../types';
import { CryptoTransaction } from '../CryptoTransaction';

Expand Down Expand Up @@ -41,7 +41,9 @@ const TransactionStatusSuccess: React.FC<TTransactionStatusSuccess> = ({ transac
</React.Fragment>
))}
{filteredTransactions.length > 3 && (
<WalletButton
<Button
borderWidth='sm'
color='black'
isFullWidth
onClick={() => {
// should navigate to transactions page with "Pending transactions" toggle on and filter set to `transactionType`
Expand All @@ -54,7 +56,7 @@ const TransactionStatusSuccess: React.FC<TTransactionStatusSuccess> = ({ transac
variant='outlined'
>
View more
</WalletButton>
</Button>
)}
</React.Fragment>
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import classNames from 'classnames';
import moment from 'moment';
import { useActiveWalletAccount, useCancelCryptoTransaction } from '@deriv/api-v2';
import { LegacyClose1pxIcon } from '@deriv/quill-icons';
import { Divider, Tooltip } from '@deriv-com/ui';
import { WalletButton, WalletText } from '../../../../../../components/Base';
import { Button, Divider, Tooltip } from '@deriv-com/ui';
import { WalletText } from '../../../../../../components/Base';
import { useModal } from '../../../../../../components/ModalProvider';
import { WalletCurrencyCard } from '../../../../../../components/WalletCurrencyCard';
import useDevice from '../../../../../../hooks/useDevice';
Expand Down Expand Up @@ -196,9 +196,16 @@ const TransactionsPendingRow: React.FC<TProps> = ({ transaction }) => {
</div>

{isMobile && !!transaction.is_valid_to_cancel && (
<WalletButton isFullWidth onClick={onCancelButtonClick} size='sm' variant='outlined'>
<Button
borderWidth='sm'
color='black'
isFullWidth
onClick={onCancelButtonClick}
size='sm'
variant='outlined'
>
Cancel transaction
</WalletButton>
</Button>
)}
</div>
</React.Fragment>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import type { THooks } from '../../../../types';
import { TransferErrorScreen } from '../../screens/TransferErrorScreen';
import { TransferForm, TransferReceipt } from './components';
import { TransferProvider, useTransfer } from './provider';
import { TransferErrorScreen } from '../../screens/TransferErrorScreen';

type TProps = {
accounts: THooks.TransferAccount[];
Expand Down
Loading
Loading