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.
- TabbedContainer Component: Create a React functional component named
TabbedContainer that accepts an array of tab configurations as props.
- Render Tabs: Display a list of clickable tab headers (buttons or similar elements) horizontally at the top of the component.
- Dynamic Content Area: Below the tab headers, render the content associated with the currently active tab.
- Tab Switching: Clicking a tab header should update the active tab and display its corresponding content.
- Initial Active Tab: The first tab in the provided configuration array should be active by default when the component mounts.
- 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.