Skip to content
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

Auto-generate SVG aspect ratios #678

Open
1 task done
danieltott opened this issue Oct 10, 2022 · 1 comment · May be fixed by #736
Open
1 task done

Auto-generate SVG aspect ratios #678

danieltott opened this issue Oct 10, 2022 · 1 comment · May be fixed by #736
Assignees
Labels
Issue for Full Member For full members who have attended a coffee session, filled out the new member for, and are in slack Tech: Typescript Type: enhancement New feature or request

Comments

@danieltott
Copy link
Member

danieltott commented Oct 10, 2022

Note for Hacktoberfest:

Virtual Coffee is reserving all open issues for Virtual Coffee members for the month of October.

Find out more about becoming a member


Issue Context

The UndrawIllustration component is used to display our nice unDraw illustrations.

In order to avoid layout jumps, we've added the aspect ratios of the svgs, but they're hard-coded which is hard to keep up to date.

What I'd like to do is generate these automatically.

Proposed solution

Build-time steps (generally):

  • Write a node script that reads the svgs, gets the width/height values, and then outputs a file (json or js/ts) in app/_generatedData that contains that data
  • Add that script to the build steps in package.json
  • Update UndrawIllustration to read from that data

Things to think about:
Any time we have generated data, we have to think about the developer experience of using the data during development. For instance, what happens if we change/add an svg? Does it automatically reload, or do I have to stop and start the server again?

Alternatives Considered

There may also be a runtime solution to this (as opposed to build-time) but I can't imagine it would be very performant. Definitely open to discussing options though.

Additional Resources

The svg-parser package looks like it could be useful.

Code of Conduct

  • I've read the Code of Conduct and understand my responsibilities as a member of the Virtual Coffee community
@danieltott danieltott added Type: enhancement New feature or request Status: Needs Triage This issue hasn't been reviewed by maintainers yet. Status: Available This issue is free to be worked on (pick me!) Issue for Full Member For full members who have attended a coffee session, filled out the new member for, and are in slack Tech: Typescript and removed Status: Needs Triage This issue hasn't been reviewed by maintainers yet. labels Oct 10, 2022
@JoeKarow
Copy link
Member

I'll take this on!

@danieltott danieltott removed the Status: Available This issue is free to be worked on (pick me!) label Oct 21, 2022
@JoeKarow JoeKarow linked a pull request Oct 30, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue for Full Member For full members who have attended a coffee session, filled out the new member for, and are in slack Tech: Typescript Type: enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants