Make spinner visual treatment work better in various sizes #154
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR replaces the thin-line "tail-spin" circle SVG image used in the
spinner
pattern andSpinner
component with a "spoked-star" animated SVG that renders more clearly in various sizes. The updated image is closer to the visual style of the client's spinner, whereas the former image was taken from LMS.This PR also takes the opportunity to convert the pattern-library pages related to spinners over to use the newer Library components.
Because handling of icon-naming and -registration is still up in the air, this PR does not attempt to alleviate any of that directly.
Note: The following images are animated GIFS. They aren't the best for capturing the smoothness of animations, and can make animation speed or transitions look a bit janky. They're also blurry, which is annoying.
Before these changes:
After these changes:
Background
The initial design of the
spinner
pattern and theSpinner
component in this project was based on the local implementation in thelms
project: an animated SVG using an image from https://github.com/SamHerbert/SVG-LoadersThe decision to use
lms
' spinner design versus theclient
's was one of implementation. In the PR for adding thespinner
pattern andSpinner
component, I mentioned in a comment that I prefer the visual styling of theclient
spinner, but the SVG implementation from LMS:Problems with the first SVG loading image
I'm revisiting this now because the tail-spin LMS-style animated SVG turns out to be nearly invisible when rendered at smaller sizes. I noticed this when I started experimenting with replacing client spinners with the component from this package. And it's often rendered on light grey, which makes it even harder to see.
None of the other SVG images from the https://github.com/SamHerbert/SVG-Loader project (nor several other open-source sources I perused) seemed to do well at
1em
square.I was able to find a 12-spoke star-like loading SVG out there in the wild. It had two shortcomings: most importantly, it was of unclear licensing/provenance, but the 12 spokes were too many; it looked tight and weird at certain sizes. What I realized when looking at the source of that image was that I could easily just roll my own with math and
svg
elements.I devised an 8-spoke animated loading SVG that I feel works solidly at the sizes we need. It is similar in visual style to the spinner used in the
client
today (that one is implemented via relatively complex CSS and nestedspan
elements so couldn't be directly reproduced in an SVG).The place the
Spinner
from this project's package is used is in the VitalSource book-picker flow in LMS. I think the new version looks good:(In case anyone is worried, I added a manual several-second delay there to demonstrate this visual spinner).
Consistency and moving forward
While the spoked SVG loader looks good in the VitalSource book picker (IMO), you might have realized that this leaves us with inconsistency in the loading spinners in LMS. If the spoked variant is amenable, I'd like to move forward with momentum to get all spinners in LMS converted to the shared (spoked) variant after this lands.
One of the things we'll need for LMS is a "Full-screen spinner", which renders a centered spinner on a full-page overlay. I've already started developing this on a local branch. Ideally, I'd like to get the updated spinner treatment and the full-screen spinner patterns and components included in the next release of the package, so that we're ready to update spinners across LMS should we choose.