Skip to content
This repository has been archived by the owner on Nov 24, 2021. It is now read-only.

Add SVG icon loader #18

Merged
merged 4 commits into from
May 19, 2017
Merged

Conversation

zehfernandes
Copy link
Contributor

I saw in the features list the item Generating icon font from SVGs

Have many articles about what is the best: "Icon Fonts vs. SVG sprite"

Personally, I prefer SVG and I think is the correct use of it. Symbols nodes with SVG sprite are more versatile, easy to align and very simple to maintain.

So, what this pull request does:

  • Create an SVG sprite using the loader svg-sprite-loader just with the SVG files in the icons folder
  • Icon component to insert the icon using the SVG file name as reference <Icon glyph='triangle' />
  • Add examples in the Dashboard page

@Stanko
Copy link
Member

Stanko commented May 18, 2017

@zehfernandes This is awesome, thank you! I totally agree this is better approach than icon fonts.

But I'll be a bit nitpicky, it seems like your IDE changed code formatting on few places. So I would really appreciate if you change it before we merge it.

Copy link
Member

@Stanko Stanko left a comment

Choose a reason for hiding this comment

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

As I said in a previous comment, this is great stuff, but please change few formatting things.

Everything else 👍

@@ -2,7 +2,9 @@ import React, { Component } from 'react';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import { testAction, testAsync } from 'actions/app';
import Icon from '../../components/Global/Icon';
Copy link
Member

Choose a reason for hiding this comment

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

you can use import Icon from 'components/Global/Icon';, as project is set up to use js folder as one of the context points.

counter,
} = this.props;

const { asyncData, asyncError, asyncLoading, counter } = this.props;
Copy link
Member

Choose a reason for hiding this comment

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

This is one of the things I think you IDE did automatically, let's keep it multiline, it is easier to track changes on git that way.

return (
<div className='Dashboard'>
<h2>Examples</h2>
<hr />
<div>
<h3>Synchronous action</h3>
<p>{ counter }</p>
<p>{counter}</p>
Copy link
Member

Choose a reason for hiding this comment

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

IDE again, add spaces back inside the curly braces. We have setup react/jsx-curly-spacing but it doesn't catch blocks, only jsx attributes.

It is known bug though
jsx-eslint/eslint-plugin-react#857

<p>{asyncData}</p>
{asyncLoading && <p>Loading...</p>}
{asyncError && <p>Error: {asyncError}</p>}
<button disabled={ asyncLoading } onClick={ this.handleAsyncButtonClick }>
Copy link
Member

Choose a reason for hiding this comment

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

Formatting - add spaces back to curly braces, keep attributes multiline.

'last 3 version',
'ie >= 10',
],
browsers: ['last 3 version', 'ie >= 10'],
Copy link
Member

Choose a reason for hiding this comment

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

Let's keep this one, as I don't think it will change soon.

new webpack.HotModuleReplacementPlugin(),
new DashboardPlugin()
);
plugins.push(new webpack.HotModuleReplacementPlugin(), new DashboardPlugin());
Copy link
Member

Choose a reason for hiding this comment

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

Formatting - keep it multiline please

'postcss-loader',
'sass-loader?sourceMap',
],
});
Copy link
Member

Choose a reason for hiding this comment

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

Please revert formatting.

],
modules: [path.resolve(__dirname, 'node_modules'), jsSourcePath],
Copy link
Member

Choose a reason for hiding this comment

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

Formatting - please revert modules to multiline. I love that extensions are now multiline as well.

@zehfernandes
Copy link
Contributor Author

zehfernandes commented May 18, 2017

@Stanko Sorry about the formatting changes.
I supposed the prettier plugin was using the eslint's rules to format. But not :(

My last commit fixed that. 👍

@oliverdore-work
Copy link
Member

@zehfernandes I made that assumption about Prettier and ESLint recently too. Easily done.

@Stanko Stanko merged commit a405503 into workco:master May 19, 2017
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.

3 participants