Coding task · JavaScript and React course · Module 10: React Ecosystem and Future

Practice: Component Library

A design system keeps colours and spacing in one place (design tokens), and components pick values from them based on props, e.g. tokens.spacing[size]. A button that is loading should be disabled and marked with aria-busy. A button with only an icon needs aria-label, because without text a screen reader does not know what it does. A component with no hooks and no event handling inside can be rendered by a Server Component.

Task

Complete the buttons of the Fleet component library. ___BLANK1___: the button is disabled when it has the disabled prop or while it is loading (loading). ___BLANK2___: the padding comes from the tokens: tokens.spacing for the chosen size (sm, md or lg). ___BLANK3___: IconButton shows only an icon, so pass Button an aria-label attribute with the value of label, so that a screen reader announces the button name. The components have no state and no effects, so they also work in Server Components.