Overview
In many Adobe creative applications and project management tools, visualizing time-bound activities or assets is crucial. Users need to quickly understand the sequence, duration, and potential overlaps of various events within a project. This problem challenges you to build a core interactive timeline component that accurately displays events, handles overlaps, and allows for basic time navigation.
What you need to do / Task
Your task is to implement a responsive horizontal timeline component with the following features:
- Timeline Scale Rendering: Display a dynamic horizontal time scale (e.g., hours, minutes) that adjusts based on the current zoom level.
- Event Display: Render a collection of
TimelineEvent items as visual blocks on the timeline. Each event has a start, end time, and a label.
- Accurate Positioning: Events must be positioned horizontally according to their
start and end times relative to the visible timeline range and current zoom level.
- Overlap Resolution: Implement a strategy to visually distinguish events that overlap in time. For instance, stack them vertically or offset them to prevent complete obscuration.
- Current Time Indicator: Display a static vertical line indicating the 'current time' (e.g., now).
- Zoom Functionality: Provide controls (e.g.,
+ and - buttons, or scroll wheel) to zoom in and out of the timeline. Zooming should adjust the visible time range and rescale event positioning accordingly.
- Event Selection: Allow users to click on an event to select it. The selected event should have a distinct visual style.
UI/UX expectations
- Layout: The timeline should be a horizontal scrollable area. The time scale should be fixed at the top, while events are rendered below it.
- Event Representation: Each event should be a rectangular block. Its width should correspond to its duration, and its horizontal position to its start time.
- Overlap Visualization: Overlapping events should be clearly visible; avoid placing them directly on top of each other. A common approach is to stack them vertically.
- Zoom Controls: Simple
+ and - buttons (or similar UI) should be available to control the zoom level.
- Current Time Indicator: A distinct vertical line (e.g., red) should mark the current time.
- Selection: Clicking an event should highlight it with a border or background change. Only one event can be selected at a time.
Acceptance criteria
- The timeline renders with a visible, dynamic time scale.
- All provided
TimelineEvent items are displayed within the timeline area.
- Events are accurately positioned and sized based on their
start/end times and the current zoom level.
- Events that overlap in time are visibly separated (e.g., stacked vertically).
- Zooming in/out correctly adjusts the visible time range and the horizontal rendering of events and the scale.
- A current time indicator is present and correctly positioned.
- Clicking an event selects it, applying a distinct visual style. Clicking another event deselects the previous one and selects the new one.