]> git.ipfire.org Git - thirdparty/bulma.git/commitdiff
Add directioner
authorJeremy Thomas <bbxdesign@gmail.com>
Tue, 21 Jan 2020 07:50:51 +0000 (08:50 +0100)
committerJeremy Thomas <bbxdesign@gmail.com>
Tue, 21 Jan 2020 07:50:51 +0000 (08:50 +0100)
sass/components/breadcrumb.sass
sass/components/dropdown.sass
sass/components/level.sass
sass/components/message.sass
sass/components/panel.sass
sass/components/tabs.sass
sass/elements/button.sass
sass/elements/content.sass
sass/form/tools.sass
sass/utilities/mixins.sass

index 3d7f4eb3c59a1d3f32060db4454d9513f7765863..d4ec476019441414f52fbd6fbc518ef3059e03dd 100644 (file)
@@ -24,7 +24,7 @@ $breadcrumb-item-separator-color: $border-hover !default
     align-items: center
     display: flex
     &:first-child a
-      padding-left: 0
+      +directioner("padding", 0, false)
     &.is-active
       a
         color: $breadcrumb-item-active-color
@@ -41,9 +41,9 @@ $breadcrumb-item-separator-color: $border-hover !default
     justify-content: flex-start
   .icon
     &:first-child
-      margin-right: 0.5em
+      +directioner("margin", 0.5em)
     &:last-child
-      margin-left: 0.5em
+      +directioner("margin", 0.5em, false)
   // Alignment
   &.is-centered
     ol,
index bf26f3fff86d39bfab4c7d55e88cc862447993b6..4eea912454714874856f6e78457d93bb76527aa5 100644 (file)
@@ -62,7 +62,7 @@ $dropdown-divider-background-color: $border-light !default
 
 a.dropdown-item,
 button.dropdown-item
-  padding-right: 3rem
+  +directioner("padding", 3rem)
   text-align: inherit
   white-space: nowrap
   width: 100%
index 608f291e758e69267bfe44f502b48ddb421a353b..696dc1c9d174c57c44a7f9d7d0ae2ffe53ce97b2 100644 (file)
@@ -20,7 +20,7 @@ $level-item-spacing: ($block-spacing / 2) !default
     .level-item
       &:not(:last-child)
         margin-bottom: 0
-        margin-right: $level-item-spacing
+        +directioner("margin", $level-item-spacing)
       &:not(.is-narrow)
         flex-grow: 1
   // Responsiveness
@@ -57,7 +57,7 @@ $level-item-spacing: ($block-spacing / 2) !default
     // Responsiveness
     +tablet
       &:not(:last-child)
-        margin-right: $level-item-spacing
+        +directioner("margin", $level-item-spacing)
 
 .level-left
   align-items: center
index f37bca38258f534811dd60e368ecc7aee8d440e8..4144dff6dbeda327f210901218984bdcf9d35d9e 100644 (file)
@@ -79,7 +79,7 @@ $message-colors: $colors !default
   .delete
     flex-grow: 0
     flex-shrink: 0
-    +margin-left(0.75em)
+    +directioner("margin", 0.75em, false)
   & + .message-body
     border-width: $message-header-body-border-width
     border-top-left-radius: 0
index 1748ccdfac6036a0cda3504d0efd79bed06a9827..c000073941c7d40c1bddd2b2c2f4409b49121009 100644 (file)
@@ -88,7 +88,7 @@ $panel-colors: $colors !default
   justify-content: flex-start
   padding: 0.5em 0.75em
   input[type="checkbox"]
-    +margin-right(0.75em)
+    +directioner("margin", 0.75em)
   & > .control
     flex-grow: 1
     flex-shrink: 1
@@ -113,7 +113,7 @@ label.panel-block
 .panel-icon
   +fa(14px, 1em)
   color: $panel-icon-color
-  +margin-right(0.75em)
+  +directioner("margin", 0.75em)
   .fa
     font-size: inherit
     line-height: inherit
index 93722475b84de7724d9e10ca1e130438ad8b279c..1dc470413f76b8afe1096846507432cb7ba9f8c3 100644 (file)
@@ -78,9 +78,9 @@ $tabs-toggle-link-active-color: $link-invert !default
       padding-left: 0.75em
   .icon
     &:first-child
-      +margin-right(0.5em)
+      +directioner("margin", 0.5em)
     &:last-child
-      +margin-left(0.5em)
+      +directioner("margin", 0.5em, false)
   // Alignment
   &.is-centered
     ul
@@ -122,7 +122,7 @@ $tabs-toggle-link-active-color: $link-invert !default
         z-index: 2
     li
       & + li
-        margin-left: -#{$tabs-toggle-link-border-width}
+        +directioner("margin", -#{$tabs-toggle-link-border-width}, false)
       &:first-child a
         +ltr
           border-radius: $tabs-toggle-link-radius 0 0 $tabs-toggle-link-radius
index 59a6d769a9ae2ab36c3e49d646a081ebc77944b4..eb7a29ac4ba8ebfba0fa7c3c9d5f34af229798c3 100644 (file)
@@ -71,11 +71,11 @@ $button-static-border-color: $border !default
       height: 1.5em
       width: 1.5em
     &:first-child:not(:last-child)
-      +margin-left(calc(#{-1 / 2 * $button-padding-horizontal} - #{$button-border-width}))
-      +margin-right($button-padding-horizontal / 4)
+      +directioner("margin", calc(#{-1 / 2 * $button-padding-horizontal} - #{$button-border-width}), false)
+      +directioner("margin", $button-padding-horizontal / 4)
     &:last-child:not(:first-child)
-      +margin-left($button-padding-horizontal / 4)
-      +margin-right(calc(#{-1 / 2 * $button-padding-horizontal} - #{$button-border-width}))
+      +directioner("margin", $button-padding-horizontal / 4, false)
+      +directioner("margin", calc(#{-1 / 2 * $button-padding-horizontal} - #{$button-border-width}))
     &:first-child:last-child
       margin-left: calc(#{-1 / 2 * $button-padding-horizontal} - #{$button-border-width})
       margin-right: calc(#{-1 / 2 * $button-padding-horizontal} - #{$button-border-width})
@@ -269,7 +269,7 @@ $button-static-border-color: $border !default
   .button
     margin-bottom: 0.5rem
     &:not(:last-child):not(.is-fullwidth)
-      +margin-right(0.5rem)
+      +directioner("margin", 0.5rem)
   &:last-child
     margin-bottom: -0.5rem
   &:not(:last-child)
index d11bdda317181369e1477ffac046df4c038ff620..32867cd2644defdedde047fb3ac5ea97759894ad 100644 (file)
@@ -67,11 +67,11 @@ $content-table-foot-cell-color: $text-strong !default
     margin-bottom: 1em
   blockquote
     background-color: $content-blockquote-background-color
-    +border-left($content-blockquote-border-left)
+    +directioner("border", $content-blockquote-border-left, false)
     padding: $content-blockquote-padding
   ol
     list-style-position: outside
-    +margin-left(2em)
+    +directioner("margin", 2em, false)
     margin-top: 1em
     &:not([type])
       list-style-type: decimal
@@ -85,7 +85,7 @@ $content-table-foot-cell-color: $text-strong !default
         list-style-type: upper-roman
   ul
     list-style: disc outside
-    +margin-left(2em)
+    +directioner("margin", 2em, false)
     margin-top: 1em
     ul
       list-style-type: circle
@@ -93,7 +93,7 @@ $content-table-foot-cell-color: $text-strong !default
       ul
         list-style-type: square
   dd
-    +margin-left(2em)
+    +directioner("margin", 2em, false)
   figure
     margin-left: 2em
     margin-right: 2em
index ddb8c2a2d364106c6f5c58eac8598f4e504977d8..7b143dc469c26a202c53aeb7050560c16d2e6df2 100644 (file)
@@ -38,7 +38,7 @@ $help-size: $size-small !default
     justify-content: flex-start
     .control
       &:not(:last-child)
-        +margin-right(-1px)
+        +directioner("margin", -1px)
       &:not(:first-child):not(:last-child)
         .button,
         .input,
@@ -96,7 +96,7 @@ $help-size: $size-small !default
       flex-shrink: 0
       &:not(:last-child)
         margin-bottom: 0
-        +margin-right(0.75rem)
+        +directioner("margin", 0.75rem)
       &.is-expanded
         flex-grow: 1
         flex-shrink: 1
@@ -127,7 +127,7 @@ $help-size: $size-small !default
     flex-basis: 0
     flex-grow: 1
     flex-shrink: 0
-    +margin-right(1.5rem)
+    +directioner("margin", 1.5rem)
     text-align: right
     &.is-small
       font-size: $size-small
@@ -156,7 +156,7 @@ $help-size: $size-small !default
       &:not(.is-narrow)
         flex-grow: 1
       &:not(:last-child)
-        +margin-right(0.75rem)
+        +directioner("margin", 0.75rem)
 
 .control
   box-sizing: border-box
index 4a4623375dd75e11fcd858049dec2c0a86392c0b..4af73d49526cf2a6403aa3484e309aa0b3e3d596 100644 (file)
 
 // $directions: ("left": "right", "right": "left")
 
-=border-right($spacing)
+=directioner($property, $spacing, $right: true)
+  $normal: if($right, "right", "left")
+  $opposite: if($right, "left", "right")
   @if $rtl
-    border-left: $spacing
+    /* RTL */
+    #{$property}-#{$opposite}: $spacing
   @else
-    border-right: $spacing
-
-=border-left($spacing)
-  @if $rtl
-    border-right: $spacing
-  @else
-    border-left: $spacing
-
-=margin-right($spacing)
-  @if $rtl
-    margin-left: $spacing
-  @else
-    margin-right: $spacing
+    /* LTR */
+    #{$property}-#{$normal}: $spacing
 
 =right($spacing)
   @if $rtl
   @else
     right: $spacing
 
-=left($spacing)
-  @if $rtl
-    right: $spacing
-  @else
-    left: $spacing
-
-=margin-left($spacing)
-  @if $rtl
-    margin-right: $spacing
-  @else
-    margin-left: $spacing
-
 // =directioner($spacing)
 //   @supports (margin-inline-end: 1px)
 //     margin-inline-end: $spacing