File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
22 "name" : " simple-nav" ,
33 "private" : true ,
4- "version" : " 2.5.0 " ,
4+ "version" : " 2.5.1 " ,
55 "type" : " module" ,
66 "scripts" : {
77 "dev" : " vite --host" ,
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ const App = () => {
3636 const [ searchQuery , setSearchQuery ] = useState ( "" ) ;
3737 const [ mousePos , setMousePos ] = useState ( { x : 0 , y : 0 } ) ;
3838 const [ isWideScreen , setIsWideScreen ] = useState ( true ) ;
39+ const [ isSearchFocused , setIsSearchFocused ] = useState ( false ) ;
3940 const searchInputRef = useRef ( null ) ;
4041
4142 // 定义配色配置
@@ -215,10 +216,15 @@ const App = () => {
215216 </ div >
216217 </ div >
217218
218- < div className = " w-full md :max-w-xl flex-1 relative group" >
219+ < div className = { `relative group flex-1 w-full transition-all duration-300 ease-in-out ${ isSearchFocused ? 'lg :max-w-xl' : 'lg:max-w-[320px]' } ` } >
219220 < div className = "absolute inset-0 bg-gradient-to-r from-indigo-500 to-violet-500 rounded-2xl blur opacity-20 group-hover:opacity-30 transition-opacity duration-300" > </ div >
220- < input ref = { searchInputRef } type = "text" value = { searchQuery } onChange = { ( e ) =>
221- setSearchQuery ( e . target . value ) }
221+ < input
222+ ref = { searchInputRef }
223+ type = "text"
224+ value = { searchQuery }
225+ onChange = { ( e ) => setSearchQuery ( e . target . value ) }
226+ onFocus = { ( ) => setIsSearchFocused ( true ) }
227+ onBlur = { ( ) => setIsSearchFocused ( false ) }
222228 placeholder = "Search resources..."
223229 className = "relative w-full bg-white/80 backdrop-blur-xl border border-white/50 rounded-2xl px-12 py-3 font-medium focus:outline-none
224230 focus:ring-2 focus:ring-indigo-500/20 transition-all duration-300
You can’t perform that action at this time.
0 commit comments