Skip to content

Commit 7ebf5d7

Browse files
authored
Bugbash fixes/updates (#1839)
1 parent 38edce9 commit 7ebf5d7

8 files changed

+22
-37
lines changed

playground/nextjs-app-router/components/demo/FundCard.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default function FundCardDemo() {
55
const presetAmountInputs: PresetAmountInputs = ['10', '20', '100'];
66

77
return (
8-
<div className="mx-auto grid w-[500px] gap-8">
8+
<div className="mx-auto min-w-[394px] max-w-[800px] gap-8">
99
<FundCard
1010
assetSymbol="ETH"
1111
country="US"

src/fund/components/FundCardAmountInputTypeSwitch.test.tsx

-6
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@ describe('FundCardAmountInputTypeSwitch', () => {
6969
'not-loading',
7070
);
7171
expect(screen.getByTestId('ockAmountLine')).toHaveTextContent('0 ETH');
72-
expect(screen.getByTestId('ockExchangeRateLine')).toHaveTextContent(
73-
'($1 = 0.00083333 ETH)',
74-
);
7572
});
7673
});
7774

@@ -88,9 +85,6 @@ describe('FundCardAmountInputTypeSwitch', () => {
8885
'not-loading',
8986
);
9087
expect(screen.getByTestId('ockAmountLine')).toHaveTextContent('$0');
91-
expect(screen.getByTestId('ockExchangeRateLine')).toHaveTextContent(
92-
'($1 = 0.00083333 ETH)',
93-
);
9488
});
9589
});
9690

src/fund/components/FundCardAmountInputTypeSwitch.tsx

+2-21
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useCallback, useMemo } from 'react';
22
import { useIcon } from '../../core-react/internal/hooks/useIcon';
33
import { getRoundedAmount } from '../../core/utils/getRoundedAmount';
44
import { Skeleton } from '../../internal/components/Skeleton';
5-
import { cn, color, pressable, text } from '../../styles/theme';
5+
import { cn, pressable, text } from '../../styles/theme';
66
import type { FundCardAmountInputTypeSwitchPropsReact } from '../types';
77
import { truncateDecimalPlaces } from '../utils/truncateDecimalPlaces';
88
import { useFundContext } from './FundCardProvider';
@@ -38,22 +38,6 @@ export const FundCardAmountInputTypeSwitch = ({
3838
[asset],
3939
);
4040

41-
const exchangeRateLine = useMemo(() => {
42-
return (
43-
<span
44-
data-testid="ockExchangeRateLine"
45-
className={cn(
46-
text.label2,
47-
color.foregroundMuted,
48-
'font-normal',
49-
'pl-1',
50-
)}
51-
>
52-
({formatUSD('1')} = {exchangeRate?.toFixed(8)} {asset})
53-
</span>
54-
);
55-
}, [formatUSD, exchangeRate, asset]);
56-
5741
const amountLine = useMemo(() => {
5842
return (
5943
<span data-testid="ockAmountLine" className={cn(text.label1)}>
@@ -88,10 +72,7 @@ export const FundCardAmountInputTypeSwitch = ({
8872
>
8973
<div className="h-[1.125rem] w-[1.125rem]">{iconSvg}</div>
9074
</button>
91-
<div className="w-full truncate">
92-
{amountLine}
93-
{exchangeRateLine}
94-
</div>
75+
<div className="w-full truncate">{amountLine}</div>
9576
</div>
9677
);
9778
};

src/fund/components/FundCardCurrencyLabel.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const FundCardCurrencyLabel = forwardRef<
1111
ref={ref}
1212
className={cn(
1313
text.body,
14-
color.foregroundMuted,
14+
color.disabled,
1515
'flex items-center justify-center bg-transparent',
1616
'text-6xl leading-none outline-none',
1717
)}

src/fund/components/FundCardPaymentMethodDropdown.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,11 @@ export function FundCardPaymentMethodDropdown({
111111
data-testid="ockFundCardPaymentMethodDropdown"
112112
className={cn(
113113
border.radius,
114-
'ock-scrollbar absolute z-10 flex w-full flex-col overflow-y-hidden',
114+
border.lineDefault,
115+
'ock-scrollbar absolute z-10 mt-2 flex w-full flex-col overflow-y-hidden',
115116
)}
116117
>
117-
<div className={cn(background.inverse, 'overflow-y-auto p-2')}>
118+
<div className={cn(background.default, 'overflow-y-auto p-2')}>
118119
{filteredPaymentMethods.map((paymentMethod) => {
119120
const isDisabled = isPaymentMethodDisabled(paymentMethod);
120121
return (

src/fund/components/FundCardPaymentMethodSelectRow.test.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describe('FundCardPaymentMethodSelectRow', () => {
2727
const button = screen.getByTestId('ockFundCardPaymentMethodSelectRow');
2828

2929
expect(button).toBeDisabled();
30-
expect(button).toHaveClass('cursor-not-allowed', 'opacity-50');
30+
expect(button).toHaveClass('opacity-[0.38] pointer-events-none');
3131
expect(button).toHaveAttribute('title', 'Minimum amount required');
3232
expect(screen.getByText('Minimum amount required')).toBeInTheDocument();
3333
});

src/fund/components/FundCardPaymentMethodSelectRow.tsx

+14-4
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@ export const FundCardPaymentMethodSelectRow = memo(
3232
className={cn(
3333
pressable.default,
3434
border.radius,
35-
background.inverse,
35+
background.default,
3636
'flex w-full items-center justify-between px-4 py-2',
37-
disabled && 'cursor-not-allowed opacity-50',
37+
{
38+
[pressable.disabled]: disabled,
39+
},
3840
)}
3941
onClick={handleOnClick}
4042
disabled={disabled}
@@ -44,13 +46,21 @@ export const FundCardPaymentMethodSelectRow = memo(
4446
{!hideImage && (
4547
<FundCardPaymentMethodImage
4648
paymentMethod={paymentMethod}
47-
className={cn('h-4 w-4', disabled && 'opacity-50')}
49+
className={cn('h-4 w-4', {
50+
[pressable.disabled]: disabled,
51+
})}
4852
/>
4953
)}
5054
<span className="flex flex-col items-start">
5155
<span className={cn(text.headline)}>{paymentMethod.name}</span>
5256
{!hideDescription && (
53-
<span className={cn(text.body, color.foregroundMuted)}>
57+
<span
58+
className={cn(
59+
text.label2,
60+
color.foregroundMuted,
61+
'font-normal',
62+
)}
63+
>
5464
{disabledReason || paymentMethod.description}
5565
</span>
5666
)}

src/fund/components/FundCardPaymentMethodSelectorToggle.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ export const FundCardPaymentMethodSelectorToggle = forwardRef(
1919
type="button"
2020
className={cn(
2121
pressable.default,
22-
pressable.shadow,
2322
border.radius,
2423
border.lineDefault,
2524
'flex h-12 w-full items-center gap-2 px-3 py-1',

0 commit comments

Comments
 (0)