Closed kellylein closed 1 month ago
4
The new component acts not only as a loading indicator, but an error message and success/empty message. This will require additional props for each state. Additionally, existing code uses a 3rd party library for animating the loading indicator which may need to be replaced. See question 5 for more info. Due to the changes mentioned, only a small amount of the existing code may be reusable, mainly around styling for center vertical and horizontal alignment.
As mentioned above, props will need to be taken into consideration for each of the possible states of the loading indicator. The existing component also does not have any analytics which will be useful for reporting error, empty, and success states.
The loading state looks visually the same as VADS web, but it will also include error and success states as mentioned. Additionally the mobile version will also have an inline variant. I don't think the additional variants warrant a new component.
Yes
The existing component currently uses lottie-react-native to display the animated SVG. We have not determined the best way to implement native 3rd party libraries into the design system repo yet. However this plugin may not be needed and we can use React Native's built-in Animated library for simple animations such as the rotation needed for the spinner.
The web's CSS to animate the spinner may be helpful to reference:
.loading-indicator::after {
content: " ";
display: inline-block;
width: 3.5rem;
height: 3.5rem;
border-top-style: ;
border-top-width: ;
border-right-style: ;
border-right-width: ;
border-bottom-style: ;
border-bottom-width: ;
border-left-style: ;
border-left-width: ;
border-image-source: ;
border-image-slice: ;
border-image-width: ;
border-image-outset: ;
border-image-repeat: ;
animation-timeline: auto;
animation-range-start: normal;
animation-range-end: normal;
margin: 1px;
border-radius: 50%;
border-color: var(--vads-color-primary) transparent var(--vads-color-primary)
transparent;
animation: 1.5s linear 0s infinite normal none running spin;
}
Possible code snippet: React Native: How do you animate the rotation of an Image?
Replacement or implementation of the lottie-react-native plugin with react native built animation as mentioned above
Screen readers should probably announce the change in state. For example if a screen takes a long time to load and then displays an error or empty message, we'd probably like the screen reader to announce that. Should check with Jessica and/or Brea.
Requires either the Icon component or usage of react-native-svg since the specs mention that we don't want to make this indicator available as part of Icon
Latest version of tokens contains all the colors that we need. Need to check with Jessica about the svg for loading state. Error and Success should be available already with the ExclamationCircle and Check icons.
No
To answer your questions:
After reading through your write-up, I have some follow-up questions/comments for you:
Discussed further in stand-up and decided that the error/success/empty states will not be part of the component and will be considered as an add-on/separate component.
Description
This story is to look at the Loading Component to determine any technical complexity we will need to account for during development.
Important links
Design updates
Acceptance Criteria
- [ ] Determine the variants needed for the component - [ ] Identify and areas that need discussion with the team for MVP scope - [ ] Create stub stories for any 1-off things needed for the component