altered conversion of shadows as mixins (incorrectly saw them as @extends)

This commit is contained in:
Kevin Ross 2015-11-04 15:57:47 -06:00
parent d607559f26
commit b21fad8b87
10 changed files with 27 additions and 28 deletions

View File

@ -17,16 +17,18 @@ module.exports = function (grunt) {
}], }],
options: { options: {
replacements: [ replacements: [
// bad conversions of shadow-z-* to @include instead of @extend
{ // https://regex101.com/r/bF2iJ2/1
pattern: /@include shadow-z-(\d+)((?:-hover)?)\(\);/gi, // convert all shadow mixins
replacement: '@extend .shadow-z-$1$2;', { // https://regex101.com/r/sJ2lH4/1
pattern: /.shadow-z-(\d+)((?:-hover)?) {/gi,
replacement: '@mixin shadow-z-$1$2 {',
order: 2 order: 2
}, },
// bad conversions of .shadow-z-* // bad conversions of .shadow-z-*
{ // https://regex101.com/r/pV0yB0/2 { // https://regex101.com/r/pV0yB0/3
pattern: /\.shadow-z-(\d+)((?:-hover)?)(?:\(\))?;/gi, pattern: /\.shadow-z-(\d+)((?:-hover)?)(?:\(\))?;/gi,
replacement: '@extend .shadow-z-$1$2;', replacement: '@include shadow-z-$1$2;',
order: 2 order: 2
}, },

View File

@ -1,8 +1,8 @@
@mixin btn-shadow(){ @mixin btn-shadow(){
@extend .shadow-z-1; @include shadow-z-1();
transition: box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1); transition: box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1);
&:active:not(.btn-link) { &:active:not(.btn-link) {
@extend .shadow-z-1-hover; @include shadow-z-1-hover();
} }
} }
@ -18,10 +18,10 @@
color: $darkbg-text; color: $darkbg-text;
&:hover:not(.btn-link):not(.btn-flat):not(.btn-fab) { &:hover:not(.btn-link):not(.btn-flat):not(.btn-fab) {
@extend .shadow-z-1; @include shadow-z-1();
} }
&:active:not(.btn-link):not(.btn-flat):not(.btn-fab) { &:active:not(.btn-link):not(.btn-flat):not(.btn-fab) {
@extend .shadow-z-1-hover; @include shadow-z-1-hover();
} }
transition: background-color 0.2s ease, box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1); transition: background-color 0.2s ease, box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1);
outline: none !important; outline: none !important;
@ -75,10 +75,10 @@
@include variations(unquote(""), background-color, transparent); @include variations(unquote(""), background-color, transparent);
} }
&, &:hover { &, &:hover {
@extend .shadow-z-1; @include shadow-z-1();
} }
&:active { &:active {
@extend .shadow-z-1-hover; @include shadow-z-1-hover();
} }
&, .ripple-wrapper { &, .ripple-wrapper {
border-radius: 100%; border-radius: 100%;

View File

@ -23,7 +23,7 @@
color: $card-body-text; color: $card-body-text;
background: $card-body-background; background: $card-body-background;
@extend .shadow-z-2; @include shadow-z-2();
.card-image { .card-image {
height: 60%; height: 60%;

View File

@ -3,7 +3,7 @@
// Material Design element Dialogs // Material Design element Dialogs
// -------------------------------------------------- // --------------------------------------------------
.modal-content { .modal-content {
@extend .shadow-z-5; @include shadow-z-5();
border-radius: 2px; border-radius: 2px;
border: none; border: none;
// Modal header // Modal header

View File

@ -3,7 +3,7 @@
border: 0; border: 0;
@include variations(unquote(" > .panel-heading"), background-color, $grey-200); @include variations(unquote(" > .panel-heading"), background-color, $grey-200);
@extend .shadow-z-1; @include shadow-z-1;
} }

View File

@ -7,7 +7,7 @@
color: $darkbg-text; color: $darkbg-text;
font-size: 14px; font-size: 14px;
border-radius: 2px; border-radius: 2px;
@extend .shadow-z-1; @include shadow-z-1;
// Animation // Animation
height: 0; height: 0;

View File

@ -4,7 +4,7 @@
background: $popover-background; background: $popover-background;
border: none; border: none;
border-radius: $material-border-radius; border-radius: $material-border-radius;
@extend .shadow-z-1; @include shadow-z-1();
} }
.tooltip, .tooltip.in { .tooltip, .tooltip.in {

View File

@ -1,34 +1,34 @@
.shadow-z-1 { @mixin shadow-z-1 {
box-shadow: box-shadow:
0 1px 6px 0 rgba(0, 0, 0, 0.12), 0 1px 6px 0 rgba(0, 0, 0, 0.12),
0 1px 6px 0 rgba(0, 0, 0, 0.12); 0 1px 6px 0 rgba(0, 0, 0, 0.12);
} }
.shadow-z-1-hover { @mixin shadow-z-1-hover {
box-shadow: box-shadow:
0 5px 11px 0 rgba(0, 0, 0, 0.18), 0 5px 11px 0 rgba(0, 0, 0, 0.18),
0 4px 15px 0 rgba(0, 0, 0, 0.15); 0 4px 15px 0 rgba(0, 0, 0, 0.15);
} }
.shadow-z-2 { @mixin shadow-z-2 {
box-shadow: box-shadow:
0 8px 17px 0 rgba(0, 0, 0, 0.2), 0 8px 17px 0 rgba(0, 0, 0, 0.2),
0 6px 20px 0 rgba(0, 0, 0, 0.19); 0 6px 20px 0 rgba(0, 0, 0, 0.19);
} }
.shadow-z-3 { @mixin shadow-z-3 {
box-shadow: box-shadow:
0 12px 15px 0 rgba(0, 0, 0, 0.24), 0 12px 15px 0 rgba(0, 0, 0, 0.24),
0 17px 50px 0 rgba(0, 0, 0, 0.19); 0 17px 50px 0 rgba(0, 0, 0, 0.19);
} }
.shadow-z-4 { @mixin shadow-z-4 {
box-shadow: box-shadow:
0 16px 28px 0 rgba(0, 0, 0, 0.22), 0 16px 28px 0 rgba(0, 0, 0, 0.22),
0 25px 55px 0 rgba(0, 0, 0, 0.21); 0 25px 55px 0 rgba(0, 0, 0, 0.21);
} }
.shadow-z-5 { @mixin shadow-z-5 {
box-shadow: box-shadow:
0 27px 24px 0 rgba(0, 0, 0, 0.2), 0 27px 24px 0 rgba(0, 0, 0, 0.2),
0 40px 77px 0 rgba(0, 0, 0, 0.22); 0 40px 77px 0 rgba(0, 0, 0, 0.22);

View File

@ -11,7 +11,7 @@ body, .container, .container-fluid {
background-color: #fff; background-color: #fff;
padding: 19px; padding: 19px;
margin-bottom: 20px; margin-bottom: 20px;
@extend .shadow-z-2; @include shadow-z-2();
border-radius: 2px; border-radius: 2px;
border: 0; border: 0;
p { p {

View File

@ -2,6 +2,7 @@
@import '_variables'; @import '_variables';
@import '_mixins'; @import '_mixins';
@import '_icons-material-design'; @import '_icons-material-design';
@import '_shadows'; // these are mixins only, and must be placed at the top before use (sass requiremnt)
body { body {
background-color: $body-bg; background-color: $body-bg;
@ -136,7 +137,3 @@ legend {
@import '_plugin-nouislider'; @import '_plugin-nouislider';
@import '_plugin-selectize'; @import '_plugin-selectize';
@import '_plugin-dropdownjs'; @import '_plugin-dropdownjs';
// Material shadows
// Place them on bottom of stylesheet to increase the importance of it and override other same-specificity selectors
@import '_shadows';