Skip to content

WIP: Templatizing SVG spinner #33782

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 178 commits into
base: master
Choose a base branch
from
Open

WIP: Templatizing SVG spinner #33782

wants to merge 178 commits into from

Conversation

rusackas
Copy link
Member

SUMMARY

Just a sketch to show reusing the SVG spinner animation in jinja AND in the Loader component.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@dosubot dosubot bot added the global:jinja Related to Jinja templating label Jun 16, 2025
transform: translate(-50%, -50%);
"
/>
<div class="spinner">
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops... I thought I already pulled in the SVG code here from the actual SVG file, rather than duplicating the code.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could basically be replaced by
{{ include('path/to/spinner.svg') }} I think.

Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review by Korbit AI

Korbit automatically attempts to detect when you fix issues in new commits.
Category Issue Status
Readability Undocumented Color Variables ▹ view 🧠 Incorrect
Performance Redundant Animation Keyframes ▹ view 🧠 Incorrect
Design Debug Statement in Production ▹ view 🧠 Incorrect
Readability Remove commented-out code ▹ view 🧠 Not in scope
Functionality Missing Accessibility Attributes ▹ view 🧠 Not in standard
Design Asset Loading Coupled to Component ▹ view 🧠 Incorrect
Performance Inefficient Animation Duration ▹ view 🧠 Not in standard
Design Inline styles violate separation of concerns ▹ view 🧠 Not in standard
Readability Unexplained SVG Dash Values ▹ view 🧠 Incorrect
Security Unsanitized SVG Content Injection ▹ view 🧠 Not in standard
Files scanned
File Path Reviewed
superset-frontend/packages/superset-ui-core/src/components/Loading/index.tsx
superset/templates/superset/basic.html

Explore our documentation to understand the languages and file types we support and the files we ignore.

Check out our docs on how you can make Korbit work best for you and your team.

Loving Korbit!? Share us on LinkedIn Reddit and X

Comment on lines +101 to +105
<animate
attributeName="d"
dur="8s"
repeatCount="indefinite"
values="M 0,0 C 7,16 22,8.7 22,0 22,-8.7 7,-16 0,0 -7,16 -22,8.7 -22,-0 -22,-8.7 -7,-16 0,0 Z;

This comment was marked as resolved.

attributeName="d"
dur="8s"
repeatCount="indefinite"
values="M 0,0 C 7,16 22,8.7 22,0 22,-8.7 7,-16 0,0 -7,16 -22,8.7 -22,-0 -22,-8.7 -7,-16 0,0 Z;

This comment was marked as resolved.

const [svgContent, setSvgContent] = useState('');

useEffect(() => {
console.log('Loading SVG');

This comment was marked as resolved.

@@ -38,28 +60,31 @@
display: block;
}
&.floating {
padding: 0;
/* padding: 0; */

This comment was marked as resolved.

aria-label="Loading"
data-test="loading-indicator"
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{ __html: svgContent }}

This comment was marked as resolved.

Comment on lines 53 to 66
<style>
.spinner svg {
--primary-color: rgb(72, 72, 72);
--accent-color: rgb(80, 165, 197);
overflow: visible;
}

.spinner {
padding: 10px;
width: 50px;
height: 50px;
overflow: visible;
}
</style>

This comment was marked as resolved.

Comment on lines +55 to +56
--primary-color: rgb(72, 72, 72);
--accent-color: rgb(80, 165, 197);

This comment was marked as resolved.

<use
href="#morphPath"
stroke="var(--primary-color, inherit)"
stroke-dasharray="108 10"

This comment was marked as resolved.

Comment on lines 80 to 84
<svg
viewBox="-36 -25 72 50"
xmlns="http://www.w3.org/2000/svg"
overflow="visible"
>

This comment was marked as resolved.

Comment on lines +76 to +80
fetch('/static/assets/images/spinner.svg')
.then(response => response.text())
.then(htmlString => {
setSvgContent(htmlString);
});

This comment was marked as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
global:jinja Related to Jinja templating packages size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants