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
add static svg sprite sheet file #1763
Conversation
The latest updates on your projects. Learn more about Vercel for Git βοΈ
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dstaley I've added a couple of suggestions (adding comments to the code for future reference) but apart from that... all good to go! π
Thanks for the contribution! π
Co-authored-by: Cristiano Rastelli <cristiano.rastelli@hashicorp.com>
Co-authored-by: Cristiano Rastelli <cristiano.rastelli@hashicorp.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The xmlns
and viewBox
changes look good! Assuming you tested the svg-sprite.svg
in your project I'm happy to get it in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, thank you for proposing something that works best for your use case.
Co-authored-by: Alex <alex-ju@users.noreply.github.com>
π Summary
This PR adds support for a plain SVG sprite sheet (in addition to the existing JavaScript module version).
π οΈ Detailed description
In order to support using the SVG sprite sheet in our Next.js websites without shipping the sprite sheet as several hundred kilobytes of JavaScript, we'd like to simply reference an SVG file. This PR outputs the generated SVG sprite sheet to an SVG file in addition to the existing JS module. Two attributes were added to the root
<svg>
element for maximum compatibility:xmlns="http://www.w3.org/2000/svg"
Some browsers will not correctly render remote<use>
references unless the remote document has the correct namespace.viewBox="0 0 0 0"
Next.js expects there to be aviewBox
attribute to calculate dimensions. While this isn't actually useful in this case, it does prevent Next.js from throwing an error about being unable to parse the file.Neither of these changes should have any impact on existing usage, hence the
minor
version bump.Β
πΈ Screenshots
π External links
Jira ticket: HDS-XXX
Figma file: [if it applies]
π Component checklist
yarn test:a11y --filter="COMPONENT-NAME"
)a11yAudit
has been added㪠Please consider using conventional comments when reviewing this PR.