Route
- Path:
/search - Component:
SearchPage - File:
source/src/pages/Search.jsx
Purpose
The search page is the primary job discovery interface, allowing users to:- View job listings matching their criteria
- Filter jobs by technology, location, and experience level
- Navigate through paginated results
- Perform text-based searches
URL Parameters
The search page reads and manages multiple URL query parameters:| Parameter | Description | Example |
|---|---|---|
text | Free-text search query | ?text=react |
technology | Technology filter | ?technology=javascript |
type | Location/work type filter | ?type=remoto |
level | Experience level filter | ?level=senior |
page | Current page number | ?page=2 |
/search?text=frontend&technology=react&type=remoto&level=mid&page=2
Key Features
1. Advanced Search Form
Provides multiple filter options:- Text Search: Free-form search across titles, skills, and companies
- Technology Filter: Dropdown for specific technologies
- Location Filter: Remote/city options
- Experience Level: Junior, Mid, Senior, Lead
2. Dynamic Results
Real-time job listings that:- Update automatically when filters change
- Show loading skeleton during fetch
- Display total count and current page in title
- Render job cards with key information
3. Pagination
Navigate through results:- 4 jobs per page (configurable via
RESULTS_PER_PAGE) - Previous/Next navigation
- Direct page number selection
- URL synchronized with current page
Components Used
The search page integrates several key components:SearchFormSection
initialTextInput: Pre-fills search text from URLonSearch: Callback for filter changesonTextFilter: Callback for text input changes
JobListings
jobs: Array of job objects to display
JobCardSkeleton
count: Number of skeleton cards to show
Pagination
currentPage: Active page numbertotalPages: Total number of pagesonPageChange: Callback when page changes
Hooks and State Management
useFilters Hook
The search page relies entirely on theuseFilters custom hook for state management:
- URL Synchronization: Reads and updates URL parameters automatically
- API Integration: Fetches jobs from backend API with filters
- Pagination Logic: Calculates offset and limit for API calls
- State Persistence: Maintains filters across page reloads
Code Example
Complete Search Page Implementation
Dynamic Title Generation
- Loading state while fetching
- Total results and current page number when loaded
User Flows
Initial Search Flow
- User arrives from home page with
?text=reactparameter - useFilters hook reads URL parameters
- API request is made with search criteria
- Loading skeleton is displayed
- Job listings render when data arrives
Filter Interaction Flow
- User changes filter (e.g., selects “Senior” level)
- handleSearch callback is triggered
- useFilters updates state and URL parameters
- Page resets to 1 (when filters change)
- API re-fetches with new criteria
- Results update automatically
Pagination Flow
- User clicks page number or Next button
- handlePageChange callback is triggered
- useFilters updates currentPage state
- URL updates with
?page={n}parameter - API fetches new page of results
- Job listings update with new page data
Text Search Flow
- User types in search input
- handleTextFilter callback is triggered
- useFilters updates textToFilter state
- URL updates with
?text={query}parameter - Page resets to 1 (new search)
- Results refresh with matching jobs
API Integration
The search page interacts with the backend API through theuseFilters hook:
API Endpoint
Query Parameters
Response Format
State Synchronization
TheuseFilters hook maintains bidirectional synchronization:
URL → State
State → URL
Loading States
The page handles three loading states:- Initial Load: Shows skeleton when component first mounts
- Filter Change: Shows skeleton when filters update
- Pagination: Shows skeleton when changing pages
Skeleton vs. Results
Structure
Integration Points
From Home Page
- Receives
?text={query}parameter from home search - Pre-fills search input with query value
- Displays filtered results immediately
To Detail Page
- Each job card links to
/jobs/{jobId} - Clicking a job navigates to detail view
- User can return via breadcrumb navigation
URL Sharing
Users can share URLs with filters:Performance Considerations
- Debouncing: Consider debouncing text input to reduce API calls
- Skeleton Loading: Provides instant visual feedback during loads
- URL State: Eliminates need for complex state management libraries
- Pagination: Limits results to 4 per page for fast loading
Accessibility
- Semantic HTML: Uses
<main>and<section>appropriately - Dynamic Title: Updates for screen readers
- Loading States: Clear indication of loading progress
- Keyboard Navigation: All controls are keyboard accessible
Related Pages
- Home Page - Entry point with search
- Detail Page - Individual job details
Related Components
- SearchFormSection - Search and filter controls
- JobListings - Results display
- Pagination - Page navigation
Related Hooks
- useFilters - Complete filter and pagination logic