1- import React , { useState , useMemo } from 'react' ;
1+ import React , { useState , useMemo , useEffect } from 'react' ;
22import { X , Search } from 'lucide-react' ;
33import { Token } from '../types' ;
44import TokenIcon from './TokenIcon' ;
@@ -18,12 +18,22 @@ const TokenModal: React.FC<TokenModalProps> = ({ isOpen, onClose, tokens, onSele
1818 const lowerSearch = search . toLowerCase ( ) ;
1919 return tokens . filter ( t => t . symbol . toLowerCase ( ) . includes ( lowerSearch ) ) ;
2020 } , [ tokens , search ] ) ;
21+ useEffect ( ( ) => {
22+ if ( ! isOpen ) {
23+ setSearch ( '' ) ;
24+ document . body . style . overflow ;
25+ } else {
26+ document . body . style . overflow = 'hidden' ;
27+ }
28+ } , [ isOpen ] ) ;
2129
22- if ( ! isOpen ) return null ;
30+ if ( ! isOpen ) {
31+ return null ;
32+ }
2333
2434 return (
2535 < div className = "fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/60 backdrop-blur-sm" >
26- < div className = "bg-white dark:bg-dark-card border border-gray-200 dark:border-gray-700 w-full max-w-md rounded-2xl shadow-2xl overflow-hidden flex flex-col max- h-[80vh] transition-colors duration-300" >
36+ < div className = "bg-white dark:bg-dark-card border border-gray-200 dark:border-gray-700 w-full max-w-md rounded-2xl shadow-2xl overflow-hidden flex flex-col h-[80vh] transition-colors duration-300" >
2737
2838 < div className = "p-4 border-b border-gray-200 dark:border-gray-700 flex justify-between items-center" >
2939 < h3 className = "text-lg font-semibold text-gray-900 dark:text-white" > Select Token</ h3 >
@@ -65,7 +75,7 @@ const TokenModal: React.FC<TokenModalProps> = ({ isOpen, onClose, tokens, onSele
6575 < span className = "font-medium text-gray-900 dark:text-white group-hover:text-primary transition-colors" > { token . symbol } </ span >
6676 < span className = "text-xs text-gray-500 dark:text-gray-400" > Price: ${ token . price . toFixed ( 4 ) } </ span >
6777 </ div >
68- < div className = "ml-auto text-gray-400 dark:text-gray-500 opacity-0 group-hover:opacity-100 transition-opacity" >
78+ < div className = "ml-auto text-gray-400 dark:text-primary opacity-0 group-hover:opacity-100 transition-opacity" >
6979 Select
7080 </ div >
7181 </ button >
0 commit comments