Skip to content

Commit 6d66b74

Browse files
committed
remove swap settings change
1 parent f807286 commit 6d66b74

File tree

1 file changed

+8
-26
lines changed

1 file changed

+8
-26
lines changed

src/swap/components/SwapSettings.tsx

+8-26
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { useCallback, useRef, useState } from 'react';
22
import { useIcon } from '../../core-react/internal/hooks/useIcon';
3-
import { Popover } from '../../internal/primitives/Popover';
43
import { background, border, cn, pressable, text } from '../../styles/theme';
54
import { useBreakpoints } from '../../ui/react/internal/hooks/useBreakpoints';
5+
import { useOutsideClick } from '../../ui/react/internal/hooks/useOutsideClick';
66
import type { SwapSettingsReact } from '../types';
77
import { SwapSettingsSlippageLayout } from './SwapSettingsSlippageLayout';
88
import { SwapSettingsSlippageLayoutBottomSheet } from './SwapSettingsSlippageLayoutBottomSheet';
@@ -17,11 +17,14 @@ export function SwapSettings({
1717
const [isOpen, setIsOpen] = useState(false);
1818
const dropdownRef = useRef<HTMLDivElement>(null);
1919

20-
const handleToggle = useCallback((e: React.MouseEvent) => {
21-
e.stopPropagation();
20+
const handleToggle = useCallback(() => {
2221
setIsOpen((prev) => !prev);
2322
}, []);
2423

24+
useOutsideClick(dropdownRef, () => {
25+
setIsOpen(false);
26+
});
27+
2528
const iconSvg = useIcon({ icon });
2629

2730
return (
@@ -61,28 +64,7 @@ export function SwapSettings({
6164
</SwapSettingsSlippageLayoutBottomSheet>
6265
</div>
6366
) : (
64-
// isOpen && (
65-
// <div
66-
// className={cn(
67-
// border.radius,
68-
// background.default,
69-
// pressable.shadow,
70-
// 'absolute right-0 z-10 mt-1 w-[21.75rem] rounded-lg',
71-
// )}
72-
// data-testid="ockSwapSettingsDropdown"
73-
// >
74-
// <SwapSettingsSlippageLayout>
75-
// {children}
76-
// </SwapSettingsSlippageLayout>
77-
// </div>
78-
// )
79-
<Popover
80-
isOpen={isOpen}
81-
onClose={() => setIsOpen(false)}
82-
anchorEl={dropdownRef.current}
83-
position="bottom"
84-
align="end"
85-
>
67+
isOpen && (
8668
<div
8769
className={cn(
8870
border.radius,
@@ -96,7 +78,7 @@ export function SwapSettings({
9678
{children}
9779
</SwapSettingsSlippageLayout>
9880
</div>
99-
</Popover>
81+
)
10082
)}
10183
</div>
10284
</div>

0 commit comments

Comments
 (0)