Frontend School

Pinterest Pin Creation Stepper

Machine Coding
medium

Pinterest Pin Creation Stepper

Medium
React
TypeScript
UI
State Management
Forms
Stepper

Overview

Creating a new Pin is a core user flow on Pinterest, allowing users to share inspiring content. This process often involves multiple distinct steps, from uploading media to adding descriptions and choosing boards. A well-designed stepper wizard significantly enhances the user experience by guiding them through the process clearly and systematically. For this problem, you'll implement the foundational UI and logic for such a multi-step Pin creation wizard.

What you need to do / Task

Your goal is to build a Stepper React component that facilitates a multi-step form flow for creating a Pinterest Pin. You will be provided with a mock steps configuration.

  1. Implement Core Stepper Logic: Manage the current active step and enable navigation forward and backward.
  2. Display Step Indicators: Visually represent all steps and clearly highlight the currently active step.
  3. Render Step Content: Dynamically display the content associated with the current active step.
  4. Navigation Buttons: Implement 'Back' and 'Next' buttons to move between steps.
  5. Conditional Navigation:
    • The 'Back' button should be disabled when on the first step.
    • The 'Next' button should be disabled if the isValid function for the current step returns false (simulating incomplete or invalid input).
    • On the final step, the 'Next' button's text should change to 'Publish'.

UI/UX expectations

  • Stepper Header: Display a list of step titles (e.g., '1. Choose Media', '2. Add Details') at the top. The active step's title should be visually distinct (e.g., bolded, different color).
  • Content Area: Below the header, render the content for the current step. For this problem, simple text content is sufficient.
  • Navigation Controls: Position 'Back' and 'Next' buttons clearly at the bottom of the content area. Ensure disabled states are visually apparent.

Acceptance criteria

  • The stepper component renders with the first step active by default.
  • Clicking 'Next' successfully advances to the subsequent step, updating both the content and the active step indicator.
  • Clicking 'Back' successfully navigates to the previous step, updating both the content and the active step indicator.
  • The 'Back' button is disabled when the first step is active.
  • The 'Next' button is disabled when the isValid property of the current step's mock data is false.
  • The 'Next' button is enabled when the isValid property of the current step's mock data is true.
  • On the last step, the 'Next' button displays 'Publish' as its text.
  • All step titles are visible in the header, with the active step clearly highlighted.

Constraints

Constraints & assumptions

  • You should use React with TypeScript.
  • Focus on functional components and React Hooks for state management.
  • The steps data will be provided as a static array within App.tsx. You do not need to fetch it from an API.
  • The isValid function for each step will be a simple boolean; you don't need to implement complex form validation logic.
  • Assume the content for each step is simple text or JSX elements provided directly in the steps array.
  • The problem is scoped to the client-side UI and logic; no backend integration is required.

Out of scope

  • Full-fledged form inputs (e.g., text fields, file uploads) for each step's content. Simple div elements with text content are sufficient.
  • Advanced accessibility features beyond standard button disabled states.
  • Complex styling or animations (basic CSS for layout and active state indication is enough).
  • Error handling beyond disabling the 'Next' button.

What interviewers evaluate

  • Component Design & State Management: How well the Stepper component is structured, and how effectively React state and props are utilized to manage the current step and navigation.
  • Conditional Rendering & Logic: Correct implementation of conditional UI elements (e.g., disabled buttons, changing button text) based on the current step and mock validation status.
  • Readability & Maintainability: Clarity, organization, and adherence to best practices in the code.
  • Basic UI/UX Implementation: Ability to translate design requirements into a functional and user-friendly interface.

Loading editor...