Show Progress in a Stepper

Write the code, see it run, pass the checks.

The problem

  • medium
  • Code

Build the progress stepper at the top of a checkout. The steps prop is a list of step names (the starter has "Basket", "Delivery", "Payment" and "Review"). Show them all, in order, in a list. The current step starts as the first; mark its element with aria-current="step", and nothing else with aria-current. Below the list, a line reads like "Step 2 of 4". A "Back" button goes to the previous step and is disabled on the first, and a "Next" button goes to the next step and is disabled on the last. Steps before the current one are done, and each is a button whose text is just the step's name, which jumps back to it. The current step and those after it must not be enabled buttons (plain text, or disabled buttons), so nobody can skip ahead.

Your code must pass

  • Starts on the first step, marked aria-current="step"
  • Next and Back move one step at a time
  • Earlier steps are buttons that jump back to them
  • Later steps can't be clicked to skip ahead
  • Back is disabled on the first step and Next on the last