Frontend School

Dynamic Campaign Performance Tabs

Machine Coding
medium

Dynamic Campaign Performance Tabs

Medium
React
UI
Component
State Management
Tabs
Dynamic Content

Overview

Inmobi's core business involves managing vast numbers of ad campaigns. A critical component for our campaign managers is a dashboard that provides quick insights into campaign performance. This problem challenges you to build a dynamic tabbed interface for a simplified campaign performance dashboard, allowing users to switch between different views of a campaign's data.

What you need to do / Task

Your primary task is to implement a reusable TabbedContainer component that renders different content based on the active tab.

  1. TabbedContainer Component: Create a React functional component named TabbedContainer that accepts an array of tab configurations as props.
  2. Render Tabs: Display a list of clickable tab headers (buttons or similar elements) horizontally at the top of the component.
  3. Dynamic Content Area: Below the tab headers, render the content associated with the currently active tab.
  4. Tab Switching: Clicking a tab header should update the active tab and display its corresponding content.
  5. Initial Active Tab: The first tab in the provided configuration array should be active by default when the component mounts.
  6. Campaign Data Display: For this specific problem, the content for each tab will be a simple display of campaign-related data. You should use the provided mock data to populate these content areas.

UI/UX expectations

  • Layout: Tabs should be arranged horizontally. The active tab's header should be visually distinct from inactive tabs (e.g., different background, border, or text color) to indicate its active state.
  • Interactions: Clicking a tab header should smoothly switch the displayed content without a full page reload.
  • Accessibility: While a full accessibility audit is out of scope, ensure basic click interactions are functional.

Acceptance criteria

  • A TabbedContainer component is implemented and correctly used in App.tsx.
  • All tab configurations passed via props are rendered as clickable headers.
  • Clicking any tab header successfully switches the displayed content to that tab's associated content.
  • The content for the initially active tab (the first tab in the tabs array) is displayed correctly on component load.
  • The active tab header is clearly visually distinguishable from inactive tab headers.
  • Each tab's content (derived from the mockCampaignData) is correctly rendered within its respective tab panel.

Constraints

Constraints & assumptions

  • You should use React (functional components and hooks).
  • The problem focuses on UI logic and component composition, not complex data fetching or advanced state management libraries.
  • Styling can be minimal but must achieve the UI/UX expectations for active/inactive tabs and general layout. CSS Modules, inline styles, or plain CSS in styles.css are acceptable.
  • The mock data for tabs and their content will be provided in /App.tsx.
  • Assume tab content can be any React.ReactNode (JSX elements).

Out of scope

  • Client-side routing (e.g., changing URL for tabs).
  • Complex animations for tab transitions.
  • Server-side rendering or advanced build configurations.
  • Extensive error handling or loading states.
  • Full keyboard navigation for tabs (focus on mouse/click interactions).

What interviewers evaluate

  • Component Design: How well the TabbedContainer component is designed, its reusability, and separation of concerns.
  • React Fundamentals: Correct use of state (useState), props, and conditional rendering for dynamic UI updates.
  • DOM Manipulation & Event Handling: Effective handling of user interactions (clicks) to change the UI.
  • Code Quality & Readability: Clarity, organization, and maintainability of the code.

Loading editor...