Improve search functionality to update URL with search queries
Refactors the onChange handler in FolxStadlPage.tsx to update the URL with the search query using `setLocation` whenever the input value changes, ensuring search state is reflected in the URL. Replit-Commit-Author: Agent Replit-Commit-Session-Id: ab9cd02a-d0b2-4288-9ceb-1964d0059648 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/ab9cd02a-d0b2-4288-9ceb-1964d0059648/YOKUxse
This commit is contained in:
parent
a34fc28345
commit
ef52d070d9
@ -100,7 +100,9 @@ export default function FolxStadlPage() {
|
||||
value={searchQuery}
|
||||
onChange={(e) => {
|
||||
setSearchQuery(e.target.value);
|
||||
if (e.target.value) setLocation(`/?search=${encodeURIComponent(e.target.value)}`);
|
||||
if (e.target.value) {
|
||||
setLocation(`/?search=${encodeURIComponent(e.target.value)}`);
|
||||
}
|
||||
}}
|
||||
className="bg-white border border-gray-300 rounded-lg px-4 py-2 pl-10 text-sm text-gray-900 placeholder-gray-500 focus:outline-none focus:border-bunny-blue transition-colors w-64"
|
||||
/>
|
||||
@ -152,7 +154,12 @@ export default function FolxStadlPage() {
|
||||
type="search"
|
||||
placeholder="Search..."
|
||||
value={searchQuery}
|
||||
onChange={(e) => setSearchQuery(e.target.value)}
|
||||
onChange={(e) => {
|
||||
setSearchQuery(e.target.value);
|
||||
if (e.target.value) {
|
||||
setLocation(`/?search=${encodeURIComponent(e.target.value)}`);
|
||||
}
|
||||
}}
|
||||
className="bg-white border border-gray-300 rounded-lg px-3 py-2 pl-9 text-sm text-gray-900 placeholder-gray-500 focus:outline-none focus:border-bunny-blue transition-colors w-full"
|
||||
/>
|
||||
<Search className="absolute left-2.5 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4" />
|
||||
|
||||
Loading…
Reference in New Issue
Block a user