]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Improved logic within `_display`, `_float` and `_font-styling`
authorharry <harmanmanchanda182@gmail.com>
Thu, 2 Feb 2017 18:38:40 +0000 (00:08 +0530)
committerharry <harmanmanchanda182@gmail.com>
Thu, 2 Feb 2017 18:38:40 +0000 (00:08 +0530)
Now its more of a DRY Coding!

scss/prototype/_display.scss
scss/prototype/_float.scss
scss/prototype/_font-styling.scss

index 2cf930f509ed3423eaaaa81a14a3931cf3656316..4689bd11ff420e66a63e012413fb970714b68e35 100644 (file)
 $prototype-display-responsive-breakpoints: $global-prototype-responsive-breakpoints !default;
 
 @mixin foundation-prototype-display {
+  @each $display in (none, inline, inline-block, block, table, table-cell) {
+    .display-#{$display} {
+      display: $display !important;
+    }
+  }
+  @if $global-flexbox {
+    @each $display-flex in (flex, inline-flex) {
+      .display-#{$display-flex} {
+        display: $display-flex !important;
+      }
+    }
+  }
+
   @if ($prototype-display-responsive-breakpoints) {
+    // Loop through Responsive Breakpoints
     @each $size in $breakpoint-classes {
       @include breakpoint($size) {
         @each $display in (none, inline, inline-block, block, table, table-cell) {
@@ -20,11 +34,6 @@ $prototype-display-responsive-breakpoints: $global-prototype-responsive-breakpoi
               display: $display !important;
             }
           }
-          @else {
-            .display-#{$display} {
-              display: $display !important;
-            }
-          }
         }
         @if $global-flexbox {
           @each $display-flex in (flex, inline-flex) {
@@ -33,28 +42,9 @@ $prototype-display-responsive-breakpoints: $global-prototype-responsive-breakpoi
                 display: $display-flex !important;
               }
             }
-            @else {
-              .display-#{$display-flex} {
-                display: $display-flex !important;
-              }
-            }
           }
         }
       }
     }
   }
-  @else {
-    @each $display in (none, inline, inline-block, block, table, table-cell) {
-      .display-#{$display} {
-        display: $display !important;
-      }
-    }
-    @if $global-flexbox {
-      @each $display-flex in (flex, inline-flex) {
-        .display-#{$display-flex} {
-          display: $display-flex !important;
-        }
-      }
-    }
-  }
 }
index 581aa624254684937cc447bace10d7543aa9c652..fe152ebfddfbc05365b1f56a0a44b91b4fd813de 100644 (file)
@@ -17,7 +17,22 @@ $prototype-float-responsive-breakpoints: $global-prototype-responsive-breakpoint
 }
 
 @mixin foundation-prototype-float {
+  // Float left and right
+  @each $float in (left, right) {
+    .float-#{$float} {
+      float: $float !important;
+    }
+  }
+  // Float center and clearfix
+  .float-center {
+    @include float-center;
+  }
+  .clearfix {
+    @include clearfix;
+  }
+
   @if ($prototype-float-responsive-breakpoints) {
+    // Loop through Responsive Breakpoints
     @each $size in $breakpoint-classes {
       @include breakpoint($size) {
         // Float left and right
@@ -27,11 +42,6 @@ $prototype-float-responsive-breakpoints: $global-prototype-responsive-breakpoint
               float: $float !important;
             }
           }
-          @else {
-            .float-#{$float} {
-              float: $float !important;
-            }
-          }
         }
         
         // Float center and clearfix
@@ -43,30 +53,7 @@ $prototype-float-responsive-breakpoints: $global-prototype-responsive-breakpoint
             @include clearfix;
           }
         }
-        @else {
-          .float-center {
-            @include float-center;
-          }
-          .clearfix {
-            @include clearfix;
-          }
-        }
       }
     }
   }
-  @else {
-    // Float left and right
-    @each $float in (left, right) {
-      .float-#{$float} {
-        float: $float !important;
-      }
-    }
-    // Float center and clearfix
-    .float-center {
-      @include float-center;
-    }
-    .clearfix {
-      @include clearfix;
-    }
-  }
 }
index 742c1ab8a2c92bf16d4fc95b75413afbb2dc206b..23cc21271a635ebf73a130b69cbf4ce8eb87ae21 100644 (file)
@@ -23,7 +23,20 @@ $prototype-font-styling-responsive-breakpoints: $global-prototype-responsive-bre
 }
 
 @mixin foundation-prototype-font-styling {
+  .font-normal {
+    @include font-normal;
+  }
+
+  .font-bold {
+    @include font-bold;
+  }
+
+  .font-italic {
+    @include font-italic;
+  }
+
   @if ($prototype-font-styling-responsive-breakpoints) {
+    // Loop through Responsive Breakpoints
     @each $size in $breakpoint-classes {
       @include breakpoint($size) {
         @if $size != $-zf-zero-breakpoint {
@@ -39,33 +52,7 @@ $prototype-font-styling-responsive-breakpoints: $global-prototype-responsive-bre
             @include font-italic;
           }
         }
-        @else {
-          .font-normal {
-            @include font-normal;
-          }
-
-          .font-bold {
-            @include font-bold;
-          }
-
-          .font-italic {
-            @include font-italic;
-          }
-        }
       }
     }
   }
-  @else {
-    .font-normal {
-      @include font-normal;
-    }
-
-    .font-bold {
-      @include font-bold;
-    }
-
-    .font-italic {
-      @include font-italic;
-    }
-  }
 }