multiple box shadow mixins use defaults

This commit is contained in:
Eric Meyer 2010-11-09 00:40:27 -07:00 committed by Chris Eppstein
parent 371e2103a7
commit 37b0bde605

View File

@ -5,6 +5,7 @@
@import "shared"; @import "shared";
// The default color for box shadows // The default color for box shadows
$default-box-shadow-color: #333333 !default; $default-box-shadow-color: #333333 !default;
@ -51,7 +52,7 @@ $default-box-shadow-inset : false !default;
// Provides cross-browser box shadows when one or more box shadows are needed. // Provides cross-browser box shadows when one or more box shadows are needed.
@mixin multiple-box-shadows( @mixin multiple-box-shadows(
$shadow-1, $shadow-1 : default,
$shadow-2 : false, $shadow-2 : false,
$shadow-3 : false, $shadow-3 : false,
$shadow-4 : false, $shadow-4 : false,
@ -62,7 +63,19 @@ $default-box-shadow-inset : false !default;
$shadow-9 : false, $shadow-9 : false,
$shadow-10: false $shadow-10: false
) { ) {
// Ugh. Sass needs variable argument support.
@if not ($default-box-shadow-inset == true or $default-box-shadow-inset == false or $default-box-shadow-inset == inset) {
@warn "$default-box-shadow-inset expected to be true or the inset keyword. Got #{$default-box-shadow-inset} instead. Using: inset";
}
@if $shadow-1 == default {
$shadow-1 : $default-box-shadow-h-offset $default-box-shadow-v-offset;
@if $default-box-shadow-blur { $shadow-1: $shadow-1 $default-box-shadow-blur; }
@if $default-box-shadow-spread { $shadow-1: $shadow-1 $default-box-shadow-spread; }
@if $default-box-shadow-color { $shadow-1: $shadow-1 $default-box-shadow-color; }
@if $default-box-shadow-inset { $shadow-1: inset $shadow-1; }
}
$shadow : $shadow-1; $shadow : $shadow-1;
@if $shadow-2 { $shadow: $shadow, $shadow-2; } @if $shadow-2 { $shadow: $shadow, $shadow-2; }
@if $shadow-3 { $shadow: $shadow, $shadow-3; } @if $shadow-3 { $shadow: $shadow, $shadow-3; }
@ -79,7 +92,7 @@ $default-box-shadow-inset : false !default;
} }
@mixin box-shadow( @mixin box-shadow(
$shadow-1, $shadow-1 : default,
$shadow-2 : false, $shadow-2 : false,
$shadow-3 : false, $shadow-3 : false,
$shadow-4 : false, $shadow-4 : false,
@ -95,4 +108,4 @@ $default-box-shadow-inset : false !default;
$shadow-4, $shadow-5, $shadow-6, $shadow-4, $shadow-5, $shadow-6,
$shadow-7, $shadow-8, $shadow-9, $shadow-10 $shadow-7, $shadow-8, $shadow-9, $shadow-10
); );
} }