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

farrah/ fix: payment methods style issues #53

Merged
merged 2 commits into from
May 8, 2024
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
35 changes: 0 additions & 35 deletions src/components/FlyoutMenu/FlyoutMenu.scss

This file was deleted.

31 changes: 0 additions & 31 deletions src/components/FlyoutMenu/FlyoutMenu.tsx

This file was deleted.

18 changes: 0 additions & 18 deletions src/components/FlyoutMenu/FlyoutMenuList.tsx

This file was deleted.

15 changes: 0 additions & 15 deletions src/components/FlyoutMenu/FlyoutMenuToggle.tsx

This file was deleted.

18 changes: 0 additions & 18 deletions src/components/FlyoutMenu/__tests__/FlyoutList.spec.tsx

This file was deleted.

30 changes: 0 additions & 30 deletions src/components/FlyoutMenu/__tests__/FlyoutMenu.spec.tsx

This file was deleted.

1 change: 0 additions & 1 deletion src/components/FlyoutMenu/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
&__body {
display: flex;
flex-direction: column;
margin-top: 0.8rem;
vertical-align: baseline;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ const PaymentMethodCardBody = ({
const isBankOrOther = modifiedDisplayName && ['BankTransfer', 'Other'].includes(modifiedDisplayName);
return (
<div className='payment-method-card__body'>
{isBankOrOther && !shouldShowPaymentMethodDisplayName ? null : <Text size='xs'>{displayName}</Text>}
<Text size='xs'>
{isBankOrOther && !shouldShowPaymentMethodDisplayName ? null : <Text>{displayName}</Text>}
<Text>
{(paymentMethod.fields?.bank_name as TBankName)?.value ?? (paymentMethod.fields?.name as TName)?.value}
</Text>
<Text size='xs'>{(paymentMethod.fields?.account as TAccount)?.value}</Text>
<Text>{(paymentMethod.fields?.account as TAccount)?.value}</Text>
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,26 @@
justify-content: space-between;
align-items: center;
margin-bottom: 1.1rem;

.deriv-dropdown {
width: 3.2rem;

&__items {
width: 12.8rem;
border: 0;
padding: 0;
}

.deriv-input {
border: 0;
padding: 0;

&__field,
&__helper-message {
display: none;
}
}
}
}
.derivs-button__variant--ghost {
color: #0e0e0e;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { THooks } from 'types';
import { FlyoutMenu } from '@/components';
import { LabelPairedEllipsisVerticalXlRegularIcon } from '@deriv/quill-icons';
import { Button, Checkbox } from '@deriv-com/ui';
import { Checkbox, Dropdown } from '@deriv-com/ui';
import { ReactComponent as IcCashierBankTransfer } from '../../../public/ic-cashier-bank-transfer.svg';
import { ReactComponent as IcCashierEwallet } from '../../../public/ic-cashier-ewallet.svg';
import { ReactComponent as IcCashierOther } from '../../../public/ic-cashier-other.svg';
Expand All @@ -20,6 +19,18 @@ type TPaymentMethodCardHeaderProps = {
type: THooks.AdvertiserPaymentMethods.Get[number]['type'];
};

// TODO: Remember to translate these
const actions = [
{
text: 'Edit',
value: 'edit',
},
{
text: 'Delete',
value: 'delete',
},
];

const PaymentMethodCardHeader = ({
isDisabled = false,
isEditable = false,
Expand All @@ -38,16 +49,7 @@ const PaymentMethodCardHeader = ({
} else if (type === 'ewallet') {
Icon = IcCashierEwallet;
}
// TODO: Remember to translate these
const flyoutMenuItems = [
<Button color='black' key={0} onClick={() => onEditPaymentMethod?.()} size='sm' textSize='xs' variant='ghost'>
Edit
</Button>,

<Button color='black' key={1} onClick={() => onDeletePaymentMethod?.()} size='sm' textSize='xs' variant='ghost'>
Delete
</Button>,
];
return (
<div className='payment-method-card__header' data-testid='dt_payment_method_card_header'>
<Icon
Expand All @@ -57,9 +59,18 @@ const PaymentMethodCardHeader = ({
width={medium || small ? 16 : 24}
/>
{isEditable && (
<FlyoutMenu
listItems={flyoutMenuItems}
renderIcon={() => <LabelPairedEllipsisVerticalXlRegularIcon className='cursor-pointer' />}
<Dropdown
className='payment-method-card__header-dropdown'
dropdownIcon={<LabelPairedEllipsisVerticalXlRegularIcon />}
list={actions}
name='payment-method-actions'
onSelect={value => {
if (value === 'edit') {
onEditPaymentMethod?.();
} else if (value === 'delete') {
onDeletePaymentMethod?.();
}
}}
/>
)}
{isSelectable && (
Expand Down
1 change: 0 additions & 1 deletion src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export * from './Clipboard';
export * from './Dropdown';
export * from './FileDropzone';
export * from './FloatingRate';
export * from './FlyoutMenu';
export * from './FormProgress';
export * from './FullPageMobileWrapper';
export * from './Header';
Expand Down
4 changes: 2 additions & 2 deletions src/pages/my-profile/screens/MyProfile/MyProfile.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
display: flex;
flex-direction: column;
padding-top: 2.4rem;
overflow-y: auto;
height: calc(100vh - 12rem);

@include mobile {
overflow-y: scroll;
height: calc(100vh - 12rem);
padding: 0;
}

Expand Down
Loading