From f9f761b0ebd49836f3cb7f661a1563f47af22319 Mon Sep 17 00:00:00 2001 From: Kevin Ross Date: Wed, 4 Nov 2015 14:34:47 -0600 Subject: [PATCH] fixed bg-box-shadow variations --- Gruntfile.js | 8 +++++++- sass/_buttons.scss | 16 ++++++++-------- sass/_mixins-shared.scss | 13 +++++++++++++ sass/_togglebutton.scss | 4 +--- 4 files changed, 29 insertions(+), 12 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 13b7bea9..c604da14 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -42,8 +42,14 @@ module.exports = function(grunt) { pattern: /.generic-variations\(unquote\(("[^"]+")\), (\$[\s\S]+?(?!\r|\n)), {$\n[\s\S]+?(?!\r|\n)background-color[\s\S]+?(?!\r|\n)(\(\d+\/\d+\))[\s\S]+?(?!\r|\n)}\);$\n/mg, replacement: '@include bg-color-variations(unquote($1), $2, $3);\n', order: 21 - } + }, + // bg-box-shadow generic-variations + { // Multi-line replacement - https://regex101.com/r/jW8kR1/1 + pattern: /.generic-variations\(unquote\(("[^"]+")\), (\$[\s\S]+?(?!\r|\n)), {$\n[\s\S]+?(?!\r|\n)box-shadow[\s\S]+?(?!\r|\n)[\s\S]+?(?!\r|\n)}\);$\n/mg, + replacement: '@include bg-box-shadow-variations(unquote($1), $2);\n', + order: 22 + } ] } } diff --git a/sass/_buttons.scss b/sass/_buttons.scss index aac00da5..84bef2b7 100644 --- a/sass/_buttons.scss +++ b/sass/_buttons.scss @@ -1,3 +1,11 @@ +@mixin btn-shadow(){ + @extend .shadow-z-1; + transition: box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1); + &:active:not(.btn-link) { + @extend .shadow-z-1-hover; + } +} + .btn { position: relative; padding: 8px 30px; @@ -127,11 +135,3 @@ .btn-group-flat { box-shadow: none !important; } - -@mixin btn-shadow(){ - @extend .shadow-z-1; - transition: box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1); - &:active:not(.btn-link) { - @extend .shadow-z-1-hover; - } -} diff --git a/sass/_mixins-shared.scss b/sass/_mixins-shared.scss index a909d923..35be8b36 100644 --- a/sass/_mixins-shared.scss +++ b/sass/_mixins-shared.scss @@ -54,6 +54,17 @@ background-color: rgba(map-get($args, material-color), map-get($args, material-param-1)); } +// bg-box-shadow-variations(" label input[type=checkbox]:checked + .toggle:active:after", $primary +@mixin bg-box-shadow-variations($extra, $default) { + @include generic-variations($extra, $default, "bg-box-shadow-variations-content", null); +} + +@mixin bg-box-shadow-variations-content($args){ + $material-color: map-get($args, material-color); + box-shadow: 0 1px 3px 1px rgba(0,0,0,0.4), 0 0 0 15px rgba($material-color, (10/100)); +} + + // interpolation of mixin-name is not allowed evidently, so we statically include based on the mixin-name given @mixin call-variations-content-mixin($args) { $mixin-name: map-get($args, mixin-name); @@ -67,6 +78,8 @@ @include button-variations-content($args); } @else if $mixin-name == bg-color-variations-content { @include bg-color-variations-content($args); + } @else if $mixin-name == bg-box-shadow-variations-content { + @include bg-box-shadow-variations-content($args); } @else { @error "Unknown mixin: #{$mixin-name}" } diff --git a/sass/_togglebutton.scss b/sass/_togglebutton.scss index fa02d777..7fc3b755 100644 --- a/sass/_togglebutton.scss +++ b/sass/_togglebutton.scss @@ -59,7 +59,5 @@ // Handle on @include variations(unquote(" label input[type=checkbox]:checked + .toggle:after"), background-color, $primary); // Ripple on - .generic-variations(unquote(" label input[type=checkbox]:checked + .toggle:active:after"), $primary, { - box-shadow: 0 1px 3px 1px rgba(0,0,0,0.4), 0 0 0 15px rgba($material-color, (10/100)); - }); + @include bg-box-shadow-variations(unquote(" label input[type=checkbox]:checked + .toggle:active:after"), $primary); }