Overview
Spotify artist profiles are central to how users discover and engage with their favorite artists. A key interaction pattern on these profiles is the use of tabs to categorize and display different types of content, such as songs, albums, and podcasts. This problem challenges you to build a simplified version of this tabbed interface, focusing on dynamic content rendering and state management.
What you need to do / Task
Your goal is to create a React component that displays a set of tabs and dynamically renders content based on the currently active tab.
- Implement a
Tabs component: This component should accept an array of tab configurations, each containing a label and content.
- Dynamic Tab Rendering: Render the tab labels horizontally.
- Active Tab Management: When a tab is clicked, it should become the active tab, and its corresponding content should be displayed. Only one tab can be active at a time.
- Content Display: The content associated with the active tab should be rendered below the tab navigation. Use the provided mock data structure.
UI/UX expectations
- Tab Layout: Tabs should be displayed horizontally, resembling navigation links.
- Active State: The active tab should have a distinct visual style (e.g., different background color, bolder text, or an underline) to clearly indicate its selected state.
- Content Area: The content for the active tab should be rendered in a distinct area below the tabs.
- Basic Styling: Apply minimal CSS to make the tabs and content distinguishable. Focus on functionality over pixel-perfect design.
Acceptance criteria
- The component renders all tab labels provided in the mock data.
- Clicking any tab makes it visually active.
- Clicking a tab hides the previously active tab's content and displays the newly active tab's content.
- Only the content of the currently active tab is visible at any given time.
- Upon initial render, the first tab is active by default, and its content is displayed.