This is a React application that allows users to search for places and view the results in a paginated table. The app is built with TypeScript and uses modern React practices for optimal performance and responsiveness.
- Node.js (version 12 or higher)
- npm (version 6 or higher)
-
Clone the repository:
git clone https://github.com/kirankumargonti/search-places.git
-
Navigate to the project directory:
cd search-places
-
Install dependencies:
npm install
-
Go to https://rapidapi.com/wirefreethought/api/geodb-cities, sign up for an API key, and create a
.env
file in the root directory with the following format:VITE_APP_API_URL=your_api_url VITE_APP_API_KEY=your_api_key_from_rapidapi
-
Start the development server:
npm run dev
-
Open http://localhost:5173 to view the app in your browser.
- Type in the search box to search for places
- Use the pagination controls to navigate through results
- Adjust the "Limit" to change the number of results fetched from the API (1-10)
- Adjust the "Items per page" to change the number of results displayed in the table (cannot exceed the limit)
- Use Ctrl/Cmd + / to quickly focus on the search input
- On smaller screens, the table view will transform into a card view for better readability
- React
- TypeScript
- CSS
- Vite - Next Generation Frontend Tooling
- Search functionality with debounced input to reduce API calls
- Paginated results display with dynamic page number generation
- Adjustable limit for API requests (1-10)
- Adjustable items per page for table display (cannot exceed the limit)
- Responsive design (down to 300px width)
- Keyboard shortcut (Ctrl/Cmd + /) to focus on the search input
- Error handling and display
- Loading spinner during API requests
- Table view transforms into card view on smaller screens
- Debounced search input and limit changes to reduce unnecessary API calls
- Memoized components using React.memo to prevent unnecessary re-renders
- useCallback for event handlers and functions to maintain referential equality
- useMemo for derived state to avoid unnecessary recalculations
- Responsive design for various screen sizes, including mobile-friendly card view for table data
- CSS variables for consistent theming and easy customization
- The app is fully responsive down to 300px width
- Table view transforms into a card view on screens smaller than 768px
- Font sizes and spacing adjust for smaller screens
- Input fields and controls stack vertically on smaller screens for better usability