Overview
At Netflix, content curation is paramount. Our content editors often need to fine-tune the sequence of episodes within a series to optimize viewer engagement or align with narrative arcs. This problem simulates a core part of their toolkit: an intuitive UI for reordering episodes within a given series. Efficiently managing episode order directly impacts viewer experience and content discoverability.
What you need to do / Task
Your task is to build a React component that allows content editors to visually reorder a list of episodes using drag-and-drop.
- Display Episodes: Render a list of episodes, each showing its title and duration.
- Enable Drag and Drop: Implement functionality that allows users to pick up an episode and drag it to a new position within the list.
- Reorder List: When an episode is dropped, update the list's internal state to reflect the new order.
- Visual Feedback: Provide clear visual cues during the drag-and-drop process.
UI/UX expectations
- Episode Item: Each episode should be presented as a distinct, clickable/draggable item, displaying its
episodeNumber, title, and duration.
- Draggable Indicator: The cursor should change to
grab when hovering over an episode item, indicating it's draggable.
- Dragging State: When an episode is being dragged, it should have a distinct visual style (e.g., reduced opacity, a border).
- Drop Target Feedback: As a dragged episode hovers over potential drop locations, provide visual feedback indicating where the item will be inserted (e.g., a line showing the insertion point, or a background highlight on the target item).
- Smooth Interaction: The drag-and-drop experience should feel responsive and smooth.
- Order Display: The current order of episode titles should be displayed below the list to confirm state updates.
Acceptance criteria
- Users can click and drag any episode item from the list.
- Dragging an episode item over another episode or between episodes visually indicates the new insertion point.
- Releasing a dragged episode correctly inserts it at the target position in the list.
- The visual order of episodes in the UI updates immediately after a drop.
- The internal component state (the
episodes array) accurately reflects the new order.
- No episodes are lost or duplicated during the reordering process.
- The provided
current-order display accurately reflects the reordered state.