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

adjust icon sizing, add icon-wrapper class, closes #763 #781

Merged
merged 2 commits into from
May 25, 2017

Conversation

samanpwbb
Copy link
Contributor

@samanpwbb samanpwbb commented May 24, 2017

This PR adds two new classes for centering icons inline, plus a new catalog entry for icons. The solution uses a wrapping element, which has some advantages:

  • Possible to center icons without dedicated classes for every font size
  • Even if icons are larger than line height, line heights will not be effected.
  • Super convenient to use with React.

The one big disadvantage being that it requires more markup. I don't think there's any other option though (trust me, I tried a lot of things here!)

The PR also increases the size of the small icon. 12px was just way too tiny. Nothing was legible.

@samanpwbb samanpwbb requested a review from tristen May 24, 2017 23:13
src/icons.css Outdated
* <p class='txt-xl'>Ring the <span class='icon-wrapper'><svg class='icon icon--l'><use xlink:href='#icon-bell'/></svg></span></p>
* <p class='txt-s'>Keep your <span class='icon-wrapper'><svg class='icon icon--s'><use xlink:href='#icon-home'/></svg></span> safe from <span class='icon-wrapper'><svg class='icon icon--s'><use xlink:href='#icon-bug'/></svg></span></p>
**/
.icon-wrapper {
Copy link
Member

Choose a reason for hiding this comment

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

Just curious, what makes the !important cut vs what doesn't?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i don't have a good answer for you. The importanted properties are the ones they definitely shouldn't ever get overriden when using this class. But the same could be said for almost every property here. Should I important everything?

Copy link
Member

@tristen tristen May 25, 2017

Choose a reason for hiding this comment

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

I would think everything except for the top property? I guess this wrapper should do what it says on the tin so everything could be important'ized

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll important all but top and I'm going to rename the class .icon-inline-wrapper

Copy link
Member

@tristen tristen left a comment

Choose a reason for hiding this comment

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

This looks like a good option!

@samanpwbb samanpwbb merged commit 8a97b51 into dev-pages May 25, 2017
@samanpwbb samanpwbb deleted the inline-icons branch May 25, 2017 15:51
vertical-align: top !important;
align-items: center !important;
justify-content: center !important;
height: 1em !important;
Copy link
Contributor

Choose a reason for hiding this comment

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

@samanpwbb: I think that conventionally we haven't been using !important unless the declaration corresponds directly to the class name. Is there a reason we need to use !important on these declarations?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants