stylesheets/toolkit/_intrinsic-ratio.scss in toolkit-1.2.2 vs stylesheets/toolkit/_intrinsic-ratio.scss in toolkit-1.3.0
- old
+ new
@@ -5,52 +5,60 @@
$intrinsic-ratio-width: 100% !default;
$intrinsic-ratio-elements: '> *' !default;
$intrinsic-ratio-extend: true !default;
$intrinsic-ratio-direction: top !default;
-@mixin intrinsic-ratio-parent {
- position: relative;
- height: 0;
+@mixin intrinsic-ratio-parent($extend: $intrinsic-ratio-extend) {
+ @if $extend {
+ @extend %intrinsic-ratio-parent;
+ }
+ @else {
+ position: relative;
+ height: 0;
+ }
}
-@mixin intrinsic-ratio-child {
- display: block;
- position: absolute;
- width: 100% !important; // Nuke the external styles
- height: 100% !important; // Nuke the external styles
- top: 0;
- margin: 0;
- padding: 0;
-}
-
-@mixin intrinsic-ratio($ratio: $intrinsic-ratio, $width: $intrinsic-ratio-width, $elements: $intrinsic-ratio-elements, $extend: $intrinsic-ratio-extend, $direction: $intrinsic-ratio-direction) {
- @if not $extend {
- @include intrinsic-ratio-parent;
+@mixin intrinsic-ratio-child($extend: $intrinsic-ratio-extend) {
+ @if $extend {
+ @extend %intrinsic-ratio-child;
}
@else {
- @extend %intrinsic-ratio-parent;
+ display: block;
+ position: absolute;
+ width: 100% !important; // Nuke the external styles
+ height: 100% !important; // Nuke the external styles
+ top: 0;
+ margin: 0;
+ padding: 0;
}
+}
+
+@mixin intrinsic-ratio-ratio($ratio: $intrinsic-ratio, $width: $intrinsic-ratio-width, $direction: $intrinsic-ratio-direction) {
padding-#{$direction}: (1 / $ratio) * $width;
+}
+
+@mixin intrinsic-ratio($ratio: $intrinsic-ratio, $width: $intrinsic-ratio-width, $elements: $intrinsic-ratio-elements, $extend: $intrinsic-ratio-extend, $direction: $intrinsic-ratio-direction) {
+
+ @include intrinsic-ratio-ratio($extend);
+
+ @include intrinsic-ratio-padding($ratio, $width, $direction);
width: $width;
+
+
@each $element in $elements {
#{$element} {
- @if not $extend {
- @include intrinsic-ratio-child;
- }
- @else {
- @extend %intrinsic-ratio-child;
- }
+ @include intrinsic-ratio-child($extend);
}
}
}
@mixin ir($ratio: $intrinsic-ratio, $width: $intrinsic-ratio-width, $elements: $intrinsic-ratio-elements, $extend: $intrinsic-ratio-extend, $direction: $intrinsic-ratio-direction) {
@include intrinsic-ratio($ratio, $width, $elements, $extend, $direction);
}
%intrinsic-ratio-parent {
- @include intrinsic-ratio-parent;
+ @include intrinsic-ratio-parent(false);
}
%intrinsic-ratio-child {
- @include intrinsic-ratio-child;
+ @include intrinsic-ratio-child(false);
}
\ No newline at end of file