Sequential Progress Bars

MediumTimersStateReact25 mins

by Pratik Rai

Read the full write-up

Clicking Add appends a progress bar. The bars fill one at a time, in the order they were created, and each takes about two seconds to reach 100%.

The markup and styling are done — the queueing is what is missing.

Requirements

  1. Clicking Add appends a new bar at 0%.

  2. Only one bar fills at any moment; the next starts when the current one reaches 100%.

  3. Each bar goes from 0 to 100 in roughly 2000ms.

  4. Add can be pressed at any time, including while a bar is filling — new bars queue behind the ones already waiting.

  5. Each bar shows its current percentage.

Notes

  • The percentage is already rendered from state, so you only have to move the numbers.

  • Pressing Add ten times should take about twenty seconds in total, not two.

Hints

Loading editor…