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

#303 - resolve sass warnings about extending compound selectors #349

Merged
merged 2 commits into from
Dec 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
149 changes: 11 additions & 138 deletions app/assets/stylesheets/fae/globals/_icons.scss
Original file line number Diff line number Diff line change
@@ -1,142 +1,15 @@
[class^="icon-"], [class*=" icon-"] {
@include icon-stuff;
@include icon-stuff;
}

.icon-home:before {
content: "\e904";
}
.icon-bars:before {
content: "\e901";
}
.icon-edit:before {
content: "\e900";
}
.icon-copy:before {
content: "\e905";
}
.icon-trash:before {
content: "\e906";
}
.icon-settings:before {
content: "\e902";
}
.icon-support:before {
content: "\e903";
}
.icon-heavy_plus:before {
content: "\e61a";
}
.icon-arrow_down:before {
content: "\e600";
}
.icon-zoom:before {
content: "\e601";
}
.icon-users:before {
content: "\e602";
}
.icon-user:before {
content: "\e603";
}
.icon-sort:before {
content: "\e606";
}
.icon-search:before {
content: "\e608";
}
.icon-plus:before {
content: "\e609";
}
.icon-offlink:before {
content: "\e60a";
}
.icon-menu:before {
content: "\e60b";
}
.icon-logout:before {
content: "\e60c";
}
.icon-delete_x:before {
content: "\e60f";
}
.icon-chevron_right:before {
content: "\e610";
}
.icon-chevron_left:before {
content: "\e611";
}
.icon-check:before {
content: "\e612";
}
.icon-calendar:before {
content: "\e613";
}
.icon-pulldown:before {
content: "\e614";
}
.icon-arrow_up:before {
content: "\e615";
}
.icon-handle:before {
content: "\e616";
}
.icon-alert:before {
content: "\e617";
}
.icon-chevron_up:before {
content: "\e618";
}
.icon-chevron_down:before {
content: "\e619";
}
.icon-fullscreen:before {
content: "\e61e";
}
.icon-question:before {
content: "\e61b";
}
.icon-eye:before {
content: "\e61c";
}
.icon-columns:before {
content: "\e61d";
}
.icon-image:before {
content: "\e90d";
}
.icon-save:before {
content: "\e962";
}
.icon-quote:before {
content: "\e977";
}
.icon-search2:before {
content: "\e986";
}
.icon-list-ol:before {
content: "\e9b9";
}
.icon-list-ul:before {
content: "\e9ba";
}
.icon-link:before {
content: "\e9cb";
}
.icon-minus:before {
content: "\ea0b";
}
.icon-font:before {
content: "\ea61";
}
.icon-bold:before {
content: "\ea62";
}
.icon-underline:before {
content: "\ea63";
}
.icon-italic:before {
content: "\ea64";
}
.icon-code:before {
content: "\ea80";
// Adding more? Use this handy find/replace regex
// \.icon\-([\w\-]+):before \{\n\s*content:\s\"\\([\w\d]+)\";\n\}
// '$1': '$2',

.icon {
@each $icon in $fae-required-icons {
&-#{nth($icon, 1)}:before {
content: fae-icon(nth($icon, 1));
}
}
}
6 changes: 3 additions & 3 deletions app/assets/stylesheets/fae/globals/_plugins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

&:after {
@include icon-stuff;
@extend .icon-arrow_down:before;
content: fae-icon(arrow_down);
position: relative;
font-size: 4px;
top: -4px;
Expand All @@ -26,14 +26,14 @@

.chosen-container-active.chosen-with-drop .chosen-single div b {
&:after {
@extend .icon-arrow_up:before;
content: fae-icon(arrow_up);
color: $c-darkest-grey;
}
}

.chosen-rtl .chosen-search, .chosen-container-single .chosen-search {
&:after {
@extend .icon-search:before;
content: fae-icon(search);
font-size: 12px;
left: auto;
right: 17px;
Expand Down
48 changes: 48 additions & 0 deletions app/assets/stylesheets/fae/globals/imports/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,51 @@ $fae-nav-stack: (
'.sticky-table-header',
'.main-header'
);

$fae-required-icons: (
'home': 'e904',
'bars': 'e901',
'edit': 'e900',
'copy': 'e905',
'trash': 'e906',
'settings': 'e902',
'support': 'e903',
'heavy_plus': 'e61a',
'arrow_down': 'e600',
'zoom': 'e601',
'users': 'e602',
'user': 'e603',
'sort': 'e606',
'search': 'e608',
'plus': 'e609',
'offlink': 'e60a',
'menu': 'e60b',
'logout': 'e60c',
'delete_x': 'e60f',
'chevron_right': 'e610',
'chevron_left': 'e611',
'check': 'e612',
'calendar': 'e613',
'pulldown': 'e614',
'arrow_up': 'e615',
'handle': 'e616',
'alert': 'e617',
'chevron_up': 'e618',
'chevron_down': 'e619',
'fullscreen': 'e61e',
'question': 'e61b',
'eye': 'e61c',
'columns': 'e61d',
'image': 'e90d',
'save': 'e962',
'quote': 'e977',
'search2': 'e986',
'list-ol': 'e9b9',
'list-ul': 'e9ba',
'link': 'e9cb',
'minus': 'ea0b',
'font': 'ea61',
'bold': 'ea62',
'underline': 'ea63',
'italic': 'ea64',
);
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,30 @@
@return false;
}

// Grabs a color from $grays map
// @param {key} $key - Key to get value from $grays map
// @return - Color value
@function gray($key: 30) {
@if map-has-key($grays, $key) {
@return map-get($grays, $key);
// Grabs a key from $list
// @param {key} $key - Key to get value from $list map
// @return - Value of key
@function mapperize($list, $key) {
@if map-has-key($list, $key) {
@return map-get($list, $key);
} @else {
// Obvious off brand color for error detection
@return #00f;
@warn "#{$key} was not found";
@return null;
}
}

@function gray($key: 30) {
@return mapperize($grays, $key);
}

@function fae-icon($key: 'home') {
$icon-code: mapperize($fae-required-icons, $key);
// Unicode chars are escaped; instead of using a slash in the map,
// we add the slash here
// https://github.com/sass/sass/issues/659#issuecomment-64818741
@return unquote("\"\\#{$icon-code}\"");
}

// Choose from a light or dark contrasting foreground color given a background
// Original function: https://medium.com/@mkel23/calculating-color-contrast-with-sass-eff39ef23f96
@function pickForegroundColor($background, $c-light, $c-dark) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
display: inline-block;

&:after {
@extend .icon-chevron_right:before;
@include icon-stuff;
content: fae-icon(chevron_right);
font-size: 8px;
display: inline-block;
padding: 0 10px;
Expand Down
6 changes: 3 additions & 3 deletions app/assets/stylesheets/fae/globals/legacy/_pre-1.3.scss
Original file line number Diff line number Diff line change
Expand Up @@ -474,8 +474,8 @@ tbody {
z-index: 1;

&:after {
@extend .icon-arrow_down:before;
@include icon-stuff;
content: fae-icon(arrow_down);
vertical-align: middle;
font-size: 5px;
color: $c-text-sub;
Expand Down Expand Up @@ -548,8 +548,8 @@ tbody {
color: $c-warning-content;

&:before {
@extend .icon-alert:before;
@include icon-stuff;
content: fae-icon(alert);
margin-right: 10px;
}

Expand Down Expand Up @@ -611,7 +611,7 @@ tbody {

&:before {
@include icon-stuff;
@extend .icon-delete_x:before;
content: fae-icon(delete_x);
font-size: 12px;
margin-right: 6px;
}
Expand Down
12 changes: 6 additions & 6 deletions app/assets/stylesheets/fae/globals/navigation/_mobilenav.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
@extend %nav-icon;

&:after {
@extend .icon-chevron_right:before;
content: fae-icon(chevron_right);
right: 18px;
top: 14px;
font-size: 11px;
Expand Down Expand Up @@ -56,8 +56,8 @@
color: $c-white;

&:before {
@extend .icon-chevron_left:before;
@include icon-stuff;
content: fae-icon(chevron_left);
border-radius: 50%;
padding: 5px 9px 5px 7px;
border: 2px solid $c-white;
Expand Down Expand Up @@ -115,25 +115,25 @@

&.-logout {
&:after {
@extend .icon-logout:before;
content: fae-icon(logout);
}
}

&.-settings {
&:after {
@extend .icon-settings:before;
content: fae-icon(settings);
}
}

&.-support {
&:after {
@extend .icon-support:before;
content: fae-icon(support);
}
}

&.-viewsite {
&:after {
@extend .icon-offlink:before;
content: fae-icon(offlink);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions app/assets/stylesheets/fae/globals/navigation/_sidenav.scss
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
&.-open {
> a {
&:after {
@extend .icon-arrow_down:before;
content: fae-icon(arrow_down);
top: 19px;
transform: rotate(0);
opacity: 1;
Expand Down Expand Up @@ -117,7 +117,7 @@
background-color: $c-white;

&:after {
@extend .icon-arrow_up:before;
content: fae-icon(arrow_up);

top: 18px;
right: 13px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@

.grabatar-link {
&:after {
@extend .icon-arrow_down:before;
@include icon-stuff;
content: fae-icon(arrow_down);
font-size: 5px;
color: $c-text-sub;
display: inline-block;
Expand Down
Loading