Frontend School

Build a Simple Vertical Event Timeline

Machine Coding
easy

Build a Simple Vertical Event Timeline

Easy
React
UI
Component
Timeline
CSS

Overview

In many applications, visualizing a sequence of events chronologically is crucial for user understanding. Think of a project management tool displaying task progress, or a social media feed showing user activities. Your task is to build a basic vertical timeline component that can display a series of events, each with a title and a date, in a clear and intuitive manner.

What you need to do / Task

Your goal is to implement a Timeline React component that satisfies the following requirements:

  1. Display Events: Render a list of events provided via props as a vertical timeline.
  2. Chronological Order: Ensure events are displayed in chronological order, with the oldest event at the top and the newest at the bottom.
  3. Event Details: For each event, display its title and date clearly.
  4. Visual Timeline Structure: Implement a visual representation of the timeline, typically a vertical line connecting distinct markers (e.g., dots or circles) for each event.
  5. Interactive Events: Make each event item clickable. When an event is clicked, an alert should be triggered displaying the title of that specific event.

UI/UX expectations

  • The timeline should be vertically oriented.
  • Each event entry should be clearly distinguishable and contain its title and date.
  • A visual vertical line should connect the event markers, indicating the flow of time.
  • Each event should have a distinct marker (e.g., a circle, dot, or icon) aligned with the connecting line.
  • Events should have a simple hover state to indicate interactivity.

Acceptance criteria

  • The Timeline component successfully renders all events from the provided mock data.
  • Events are visually ordered from oldest to newest (top to bottom).
  • Each rendered event clearly displays its title and date.
  • A continuous vertical line and distinct markers are present, forming a clear timeline structure.
  • Clicking on any event item triggers a browser alert() showing the title of the clicked event.

Constraints

Constraints & assumptions

  • You should use React functional components.
  • Styling should be done using CSS (either /styles.css or inline styles).
  • Dates will be provided as simple string formats (e.g., "YYYY-MM-DD"); no complex date parsing or formatting libraries are required.
  • The component should not rely on any third-party UI libraries (e.g., Material-UI, Ant Design).
  • The list of events is static for this problem; no dynamic additions or removals are needed.

Out of scope

  • Advanced date formatting (e.g., '2 days ago', 'next Tuesday').
  • Horizontal timeline layouts.
  • Infinite scrolling or pagination for events.
  • Accessibility features beyond basic semantic HTML elements.

What interviewers evaluate

  • Correct implementation of a React component following the specified requirements.
  • Effective use of React props and state management (if applicable).
  • Clean, readable, and maintainable code structure.
  • Basic CSS styling proficiency to achieve the desired UI/UX.

Loading editor...