Add small and inline Spinner variants. - #6111
Open
michelinewu wants to merge 7 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds new rendering options for the shared React <Spinner /> so it can be used inline (non-overlay) and introduces a “small” size rule for the underlying SVG class used by the spinner markup.
Changes:
- Add
inline,width, andheightprops toapp/components-react/shared/Spinner.tsxand apply.inlinestyling. - Add
.inlinecontainer styling inSpinner.m.lessto undo the overlay behavior. - Add missing
.s-spinner--smallsizing rule inapp/styles/loader.less.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| app/styles/loader.less | Adds missing .s-spinner--small dimensions (and minor formatting change to import). |
| app/components-react/shared/Spinner.tsx | Adds inline and size-related props and applies them to the outer spinner container. |
| app/components-react/shared/Spinner.m.less | Adds an .inline variant to make the spinner participate in normal flow instead of overlaying its parent. |
Suppressed comments (1)
app/components-react/shared/Spinner.tsx:72
- Setting
width/heighton the outer container doesn’t actually resize the spinner graphic because the injected SVG is alwaysclass="s-spinner--small"andloader.lessnow fixes that class to 15×15. If the goal is to make spinner size configurable, the sizing needs to apply to the SVG (or its class) rather than just the container; otherwisewidth/heightis likely to be surprising/misleading to callers.
<div
className={classNames}
key="spinner"
style={{ transitionDelay: `${p.delay}ms`, width: p.width, height: p.height }}
>
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
BundleMonFiles updated (1)
Unchanged files (3)
Total files change +580B 0% Final result: ✅ View report in BundleMon website ➡️ |
Comment on lines
58
to
+62
| [css.container]: true, | ||
| [css.hasVisibleSpinner]: visibility.isSpinnerVisible, | ||
| [css.spinnerRelative]: p.relative, | ||
| [css.pageLoader]: p.pageLoader, | ||
| [css.inline]: p.inline, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Shared Spinner Inline and Small Variants
Stack:
master← mw_fix_ss ← mw_ms_toggle_1Issues
There was no way to render the spinner in flow.
.containerisposition: absolutewithwidth/heightat 100% and a background colour, so every<Spinner />covers its positioning parent. There was no variant that sits inline next to other content and takes only the space it needs.Size was fixed at the stylesheet level.
.s-spinner--smallexisted but did nothing. The sharedspinnerSvgconstant inSpinner.tsxhas always renderedclass="s-spinner--small"on its<svg>, andloader.lessdefined.s-spinner--large(80×56) but never a matching--smallrule.Fixes
inlineprop adds a.inlineclass that undoes the overlay.widthandheightprops are applied to the container's inlinestyle..s-spinner--smallgets its ruleFiles changed:
app/components-react/shared/Spinner.tsx,app/components-react/shared/Spinner.m.less,app/styles/loader.lessPerformance Implications
None.