Skip to content

Commit 0b4fb12

Browse files
committed
update animations, mobile widths
1 parent d5c7088 commit 0b4fb12

8 files changed

+33
-12
lines changed

src/internal/components/MobileTray.test.tsx

+9-3
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,15 @@ describe('MobileTray', () => {
4646
expect(defaultProps.onAnimationEnd).toHaveBeenCalled();
4747
});
4848

49-
it('applies custom animation class when provided', () => {
50-
render(<MobileTray {...defaultProps} animation="custom-animation" />);
51-
expect(screen.getByTestId('ockMobileTray')).toHaveClass('custom-animation');
49+
it('applies custom animation classes when provided', () => {
50+
render(
51+
<MobileTray
52+
{...defaultProps}
53+
animation={{ tray: 'custom-tray', overlay: 'custom-overlay' }}
54+
/>,
55+
);
56+
expect(screen.getByTestId('ockMobileTray')).toHaveClass('custom-tray');
57+
expect(screen.getByRole('presentation')).toHaveClass('custom-overlay');
5258
});
5359

5460
it('applies default translation classes when no animation prop is provided', () => {

src/internal/components/MobileTray.tsx

+6-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ type MobileTrayProps = {
77
onAnimationEnd?: () => void;
88
onOverlayClick: () => void;
99
onEscKeyPress: (event: React.KeyboardEvent<HTMLDivElement>) => void;
10-
animation?: string;
10+
animation?: {
11+
tray: string;
12+
overlay: string;
13+
};
1114
className?: string;
1215
};
1316

@@ -27,6 +30,7 @@ export function MobileTray({
2730
className={cn(
2831
'fixed inset-0',
2932
'bg-black bg-opacity-20 dark:bg-white dark:bg-opacity-10',
33+
animation?.overlay,
3034
zIndex.modal,
3135
)}
3236
onClick={onOverlayClick}
@@ -42,7 +46,7 @@ export function MobileTray({
4246
'fixed right-0 bottom-0 left-0',
4347
'transform rounded-t-3xl p-2 transition-transform',
4448
animation
45-
? animation
49+
? animation.tray
4650
: `${isOpen ? 'translate-y-0' : 'translate-y-full'}`,
4751
className,
4852
)}

src/wallet/components/WalletAdvancedContent.tsx

+7-4
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export function WalletAdvancedContent({
3838
<div
3939
className={cn(
4040
'flex flex-col items-center justify-center',
41-
'h-120 w-88',
41+
'h-120 w-full',
4242
showQr ? '' : 'hidden',
4343
)}
4444
>
@@ -47,7 +47,7 @@ export function WalletAdvancedContent({
4747
<div
4848
className={cn(
4949
'flex flex-col items-center justify-center',
50-
'h-120 w-88',
50+
'h-120 w-full',
5151
showSwap ? '' : 'hidden',
5252
)}
5353
>
@@ -74,7 +74,7 @@ export function WalletAdvancedContent({
7474
<div
7575
className={cn(
7676
'flex flex-col items-center justify-between',
77-
'h-120 w-88',
77+
'h-120 w-full',
7878
'px-4 py-3',
7979
showQr || showSwap ? 'hidden' : '',
8080
)}
@@ -91,7 +91,10 @@ export function WalletAdvancedContent({
9191
onOverlayClick={handleClose}
9292
onEscKeyPress={handleClose}
9393
onAnimationEnd={handleAnimationEnd}
94-
animation={animations.mobileContainer}
94+
animation={{
95+
tray: animations.mobileContainer,
96+
overlay: animations.mobileContainerOverlay,
97+
}}
9598
>
9699
<div className="flex h-full w-full flex-col items-center justify-center">
97100
{content}

src/wallet/components/WalletAdvancedProvider.test.tsx

+5
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ describe('useWalletAdvancedContext', () => {
7575
container: expect.any(String),
7676
content: expect.any(String),
7777
mobileContainer: expect.any(String),
78+
mobileContainerOverlay: expect.any(String),
7879
},
7980
});
8081
});
@@ -139,6 +140,7 @@ describe('useWalletAdvancedContext', () => {
139140
'fade-out slide-out-to-top-1.5 animate-out fill-mode-forwards ease-in-out',
140141
mobileContainer:
141142
'fade-out slide-out-to-bottom-1/2 animate-out duration-200 fill-mode-forwards ease-in-out',
143+
mobileContainerOverlay: 'fade-out animate-out duration-300 ease-in-out',
142144
content: '',
143145
});
144146
});
@@ -159,6 +161,7 @@ describe('useWalletAdvancedContext', () => {
159161
'fade-out slide-out-to-bottom-1.5 animate-out fill-mode-forwards ease-in-out',
160162
mobileContainer:
161163
'fade-out slide-out-to-bottom-1/2 animate-out duration-200 fill-mode-forwards ease-in-out',
164+
mobileContainerOverlay: 'fade-out animate-out duration-300 ease-in-out',
162165
content: '',
163166
});
164167
});
@@ -179,6 +182,7 @@ describe('useWalletAdvancedContext', () => {
179182
'fade-in slide-in-from-top-1.5 animate-in duration-300 ease-out',
180183
mobileContainer:
181184
'fade-in slide-in-from-bottom-1/2 animate-in duration-300 ease-out',
185+
mobileContainerOverlay: 'fade-in animate-in duration-300',
182186
content:
183187
'fade-in slide-in-from-top-2.5 animate-in fill-mode-forwards duration-300 ease-out',
184188
});
@@ -200,6 +204,7 @@ describe('useWalletAdvancedContext', () => {
200204
'fade-in slide-in-from-bottom-1.5 animate-in duration-300 ease-out',
201205
mobileContainer:
202206
'fade-in slide-in-from-bottom-1/2 animate-in duration-300 ease-out',
207+
mobileContainerOverlay: 'fade-in animate-in duration-300',
203208
content:
204209
'fade-in slide-in-from-bottom-2.5 animate-in fill-mode-forwards duration-300 ease-out',
205210
});

src/wallet/components/WalletAdvancedProvider.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ function getAnimations(
8282
: 'fade-out slide-out-to-top-1.5 animate-out fill-mode-forwards ease-in-out',
8383
mobileContainer:
8484
'fade-out slide-out-to-bottom-1/2 animate-out duration-200 fill-mode-forwards ease-in-out',
85+
mobileContainerOverlay: 'fade-out animate-out duration-300 ease-in-out',
8586
content: '',
8687
};
8788
}
@@ -92,6 +93,7 @@ function getAnimations(
9293
: 'fade-in slide-in-from-top-1.5 animate-in duration-300 ease-out',
9394
mobileContainer:
9495
'fade-in slide-in-from-bottom-1/2 animate-in duration-300 ease-out',
96+
mobileContainerOverlay: 'fade-in animate-in duration-300',
9597
content: showSubComponentAbove
9698
? 'fade-in slide-in-from-bottom-2.5 animate-in fill-mode-forwards duration-300 ease-out'
9799
: 'fade-in slide-in-from-top-2.5 animate-in fill-mode-forwards duration-300 ease-out',

src/wallet/components/WalletAdvancedTransactionActions.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export function WalletAdvancedTransactionActions() {
6767
return (
6868
<div
6969
className={cn(
70-
'my-3 flex w-full flex-row justify-center gap-2',
70+
'my-3 flex w-full flex-row justify-between gap-2',
7171
animations.content,
7272
)}
7373
>
@@ -100,7 +100,7 @@ function WalletAdvancedTransactionAction({
100100
type="button"
101101
className={cn(
102102
'flex flex-col items-center justify-center gap-2 pt-2.5 pb-2',
103-
'h-16 w-28',
103+
'h-16 flex-1',
104104
border.radius,
105105
pressable.alternate,
106106
)}

src/wallet/components/WalletAdvancedWalletActions.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export function WalletAdvancedWalletActions() {
3939
return (
4040
<div
4141
className={cn(
42-
'flex w-80 items-center justify-between',
42+
'flex w-full items-center justify-between',
4343
animations.content,
4444
)}
4545
>

src/wallet/types.ts

+1
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ export type WalletAdvancedContextType = {
204204
animations: {
205205
container: string;
206206
mobileContainer: string;
207+
mobileContainerOverlay: string;
207208
content: string;
208209
};
209210
};

0 commit comments

Comments
 (0)