Overview
As a leading travel booking platform, Ixigo prioritizes providing users with clear, efficient, and interactive ways to explore travel options. A core component of our user experience is the display of flight schedules. This problem challenges you to build a foundational interactive flight data table that allows users to easily sort and filter flight information, mimicking a crucial aspect of our platform.
What you need to do / Task
Your goal is to build a React component that displays a list of flight details in a table format, incorporating essential user interaction features:
- Display Flight Data: Render a responsive HTML table to display the provided mock flight data. Each flight object will include properties such as
flightNumber, origin, destination, departureTime, arrivalTime, price, and airline.
- Implement Sorting: Enable users to sort the flight data by
price and departureTime. Clicking on the respective column headers should toggle the sort order between ascending, descending, and potentially an unsorted or default state.
- Implement Filtering: Provide a text input field above the table. As the user types, the table should dynamically filter flights based on a case-insensitive partial match against the
airline name.
- Combine Interactions: Ensure that both sorting and filtering functionalities can be applied simultaneously. For instance, a user should be able to filter by an airline and then sort the filtered results by price.
UI/UX expectations
- The primary display should be an HTML
<table> element.
- Column headers for sortable fields (e.g., 'Price', 'Departure Time') should visually indicate their sortability (e.g., with a pointer cursor).
- When a column is actively sorted, there should be a visual indicator (e.g., an arrow icon ▲/▼ next to the header) showing the current sort direction.
- A clearly visible text input field for filtering should be positioned above the table.
- Basic styling should be applied to ensure readability and a clean layout, making the table and input elements distinct and user-friendly.
Acceptance criteria
- [ ] The table correctly displays all initial flight data rows and columns.
- [ ] Clicking the 'Price' column header correctly sorts flights by price (ascending -> descending -> initial/ascending cycle).
- [ ] Clicking the 'Departure Time' column header correctly sorts flights by departure time (ascending -> descending -> initial/ascending cycle).
- [ ] The filter input field dynamically filters the displayed flights by
airline name (case-insensitive, partial match).
- [ ] Sorting and filtering functionalities work together seamlessly; filtering applies first, then sorting applies to the filtered dataset.
- [ ] The application is functional and free of console errors or warnings.