Coding task · JavaScript and React course · Module 15: Patterns and Architecture

Practice: Atomic Design

An atom is the smallest piece of the interface and knows nothing about mission data. A molecule combines a few atoms into one function, and an organism builds a whole section of the screen from molecules. Each level uses only the levels below it, so the same ProgressBar will serve other screens too. The progressbar role with aria-label, aria-valuenow, aria-valuemin and aria-valuemax tells a screen reader what the bar is about and what progress it shows. A width in a React style without a unit (a bare number) means pixels, which is why you add the % sign.

Task

Build the ship systems panel from atoms, a molecule and an organism. The ProgressBar atom limits the value to the range 0-100 (the percent constant): ___BLANK1___ is the value of the aria-valuenow attribute, and ___BLANK2___ is the width of the fill in percent as a string, for example '45%'. The StatusRow molecule combines atoms: ___BLANK3___ is the ProgressBar atom with the value value and the label label (a screen reader takes the name of the bar from it), placed between the name and the badge. The SystemsPanel organism creates a StatusRow for every system: ___BLANK4___ is the badge colour read from STATUS_COLORS by the system status (online, degraded, offline).