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

ref(svg): convert jsx svgs to raw svgs #6843

Merged
merged 11 commits into from
Jan 2, 2018
Merged

ref(svg): convert jsx svgs to raw svgs #6843

merged 11 commits into from
Jan 2, 2018

Conversation

Chrissy
Copy link
Contributor

@Chrissy Chrissy commented Dec 29, 2017

Not gonna include icon-file-generic and icon-open in this one because I need to get mock data working for release overviews.

Everything else has been tested and looks identical.

@Chrissy Chrissy changed the title fef(build): Convert jsx svgs to raw svgs ref(build): Convert jsx svgs to raw svgs Dec 29, 2017
@Chrissy Chrissy changed the title ref(build): Convert jsx svgs to raw svgs ref(build): convert jsx svgs to raw svgs Dec 29, 2017
@ghost
Copy link

ghost commented Dec 29, 2017

1 Warning
⚠️ You should update CHANGES due to the size of this PR

Generated by 🚫 danger

@Chrissy Chrissy changed the title ref(build): convert jsx svgs to raw svgs ref(svg): convert jsx svgs to raw svgs Dec 29, 2017
@Chrissy Chrissy requested a review from ckj January 2, 2018 19:37
@Chrissy
Copy link
Contributor Author

Chrissy commented Jan 2, 2018

@ckj I think you will be able to review this in full, as there aren't any substantive changes. just:

  1. Converting .jsx files over to .svg
  2. Swapping out the import statements in the templates
  3. Beefing up the inlineSvg component to take all the same params as react-icon-base

I reviewed all of these visually and they should look identical, minus a few alignment bugs I tweaked to fix.

This looks like a lot of code but it's all pretty fluffy!

@@ -32,6 +32,17 @@ module.exports = {
test: /\.css$/,
use: ['style-loader', 'css-loader'],
},
{
Copy link
Contributor Author

Choose a reason for hiding this comment

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

these changes are just a duplication of what we do in the primary webpack config file, since we need the same support in storybook land.

Copy link
Member

Choose a reason for hiding this comment

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

👍

@@ -330,7 +329,7 @@ class FormField extends React.Component {
} else if (isSaved) {
return (
<SettingsIsSaved>
<IconCheckmarkSm size="18" />
<InlineSvg src="icon-checkmark-sm" size="18px" />
Copy link
Contributor Author

@Chrissy Chrissy Jan 2, 2018

Choose a reason for hiding this comment

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

Most browsers use a common sense approach when it comes to unit-less values as attributes, which is why all these naked numbers get converted to pixels and not ems, percentages, vms, etc.

But that kind of ambiguity is somewhat confusing and unpredictable. So I converted them all to pixel values.

Copy link
Member

Choose a reason for hiding this comment

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

Makes sense.

Copy link
Member

@ckj ckj left a comment

Choose a reason for hiding this comment

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

I'm curious about the camelCased SVG attributes (I commented on them inline). If they're not a concern, then it LGTM otherwise 👍

@@ -32,6 +32,17 @@ module.exports = {
test: /\.css$/,
use: ['style-loader', 'css-loader'],
},
{
Copy link
Member

Choose a reason for hiding this comment

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

👍

strokeWidth="1"
fill="none"
strokeLinecap="round"
strokeLinejoin="round"
Copy link
Member

Choose a reason for hiding this comment

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

I had to manually camelCase all of these attributes to js-ify them for React. In the SVG spec, they're hyphenated e.g. stroke-linejoin="round". Is this something we should revert back to or does it matter?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes! good call!!

@@ -330,7 +329,7 @@ class FormField extends React.Component {
} else if (isSaved) {
return (
<SettingsIsSaved>
<IconCheckmarkSm size="18" />
<InlineSvg src="icon-checkmark-sm" size="18px" />
Copy link
Member

Choose a reason for hiding this comment

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

Makes sense.

@billyvg
Copy link
Member

billyvg commented Jan 2, 2018

Unrelated, but it would be awesome if we had a section in storybook for all of our icons

@Chrissy Chrissy merged commit 751be1b into master Jan 2, 2018
@Chrissy Chrissy deleted the react_svg_to_svg branch January 4, 2018 19:23
@github-actions github-actions bot locked and limited conversation to collaborators Dec 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants