Overview
SearchBar is a controlled input component that allows users to search for movies. It provides a text input field with a search icon and placeholder text.
Import
Props
Current value of the search input (controlled component pattern)
Callback function invoked when the input value changesSignature:
(value: string) => voidParameters:value(string): The new search term entered by the user
Component Signature
Features
Controlled Input
The component follows React’s controlled component pattern:Search Icon
Includes a visual search icon (magnifying glass emoji) for better UX:Usage Example
- With usePeliculaSearch Hook
- With Local State
Rendered Structure
CSS Classes
.search-bar- Container div.search-bar__input- Text input element.search-bar__icon- Search icon span
Accessibility
- Uses semantic
<input type="text">element - Includes descriptive placeholder text
- Keyboard accessible by default
Integration Notes
When used withusePeliculaSearch, the search term filters movies by:
- Movie title (case-insensitive)
- Director name (case-insensitive)
- Cast member names (case-insensitive)
Source Location
src/components/SearchBar.jsx:3