Frontend School

Apple ID Profile Setup Form

Machine Coding
easy

Apple ID Profile Setup Form

Easy
React
Forms
State Management
UI

Overview

Setting up an Apple ID is the gateway to Apple's ecosystem, and a smooth onboarding experience is crucial. This problem challenges you to build a simplified multi-step form for creating an Apple ID profile. This ensures users can easily provide necessary information in a structured manner, enhancing the initial user experience and data collection integrity.

What you need to do / Task

Your task is to implement a multi-step form in React with the following structure and functionality:

  1. Step 1: Personal Information
    • Fields: First Name (text), Last Name (text), Email (email).
    • Validation: All fields are required. Email must be a valid email format.
  2. Step 2: Security Information
    • Fields: Password (password), Confirm Password (password).
    • Validation: Both fields are required. Password must be at least 8 characters long. Confirm Password must match Password.
  3. Navigation
    • Implement "Next" and "Back" buttons to navigate between steps.
    • The "Next" button should only proceed if the current step's form fields are valid.
    • The "Back" button should always return to the previous step.
    • On the last step, the "Next" button should be replaced by a "Submit" button.
  4. Submission
    • Upon successful submission (all steps completed and valid), display a "Profile Created Successfully!" message along with a summary of the entered data (excluding passwords).

UI/UX expectations

  • Layout: A central container for the form. Each step should clearly display its fields.
  • Step Indicator: Optionally, a simple text indicator like "Step 1 of 2" could be shown.
  • Inputs: Use standard HTML input types (text, email, password) with clear label elements for accessibility.
  • Buttons: Clearly labeled "Next", "Back", and "Submit" buttons.
  • Validation Feedback: Display inline error messages for invalid fields.
  • Accessibility: Ensure labels are associated with their respective input fields.

Acceptance criteria

  • The form initially renders showing "Step 1: Personal Information".
  • "Next" button successfully navigates from Step 1 to Step 2 when Step 1 fields are valid.
  • "Back" button successfully navigates from Step 2 to Step 1.
  • "Submit" button is visible only on Step 2.
  • Clicking "Next" on Step 1 with invalid data prevents navigation and displays validation errors.
  • Clicking "Submit" on Step 2 with invalid data prevents submission and displays validation errors.
  • All form data is preserved when navigating between steps.
  • Upon successful submission, a summary of the non-sensitive profile data is displayed, and the form elements are hidden.

Constraints

Constraints & assumptions

  • Environment: Modern browser environment with React.
  • Data Handling: All form data will be managed purely client-side in React component state. No external API calls or database interactions are required.
  • Styling: Basic, functional styling is sufficient. Focus on layout and readability rather than Apple brand aesthetics.
  • Libraries: You are expected to use plain React hooks for state management and form handling. No external form libraries (e.g., Formik, React Hook Form) are permitted.
  • Validation: Implement simple client-side validation logic. Regular expressions for email validation are acceptable but not strictly required; a basic check for @ and . is fine.

Out of scope

  • Server-side validation or API integration.
  • Advanced routing solutions (e.g., React Router).
  • Complex animations or transitions between steps.
  • User authentication or session management.
  • Persistence of data across browser sessions (e.g., local storage).

What interviewers evaluate

  • State Management: Effective use of React state to manage form data and navigation across steps.
  • Component Structure: Logical organization of UI into reusable or clearly defined components.
  • Form Validation: Implementation of basic client-side validation and clear feedback to the user.
  • User Experience: Adherence to UI/UX expectations for a multi-step form, including accessibility.

Loading editor...