vendor/assets/scss/components/_button-group.scss in foundation-rails-6.3.0.0 vs vendor/assets/scss/components/_button-group.scss in foundation-rails-6.3.1.0
- old
+ new
@@ -9,11 +9,11 @@
/// Margin for button groups.
/// @type Number
$buttongroup-margin: 1rem !default;
/// Margin between buttons in a button group.
-/// @type Border
+/// @type Number
$buttongroup-spacing: 1px !default;
/// Selector for the buttons inside a button group.
/// @type String
$buttongroup-child-selector: '.button' !default;
@@ -26,12 +26,14 @@
/// @type Boolean
$buttongroup-radius-on-each: true !default;
/// Add styles for a button group container.
/// @param {String} $child-selector [$buttongroup-child-selector] - Selector for the buttons inside a button group.
+/// @param {Number} $spacing [$buttongroup-spacing] - Spacing between buttons in a button group.
@mixin button-group(
- $child-selector: $buttongroup-child-selector
+ $child-selector: $buttongroup-child-selector,
+ $spacing: $buttongroup-spacing
) {
@include clearfix;
margin-bottom: $buttongroup-margin;
@if $global-flexbox {
@@ -43,12 +45,12 @@
font-size: 0;
}
#{$child-selector} {
margin: 0;
- margin-#{$global-right}: $buttongroup-spacing;
- margin-bottom: $buttongroup-spacing;
+ margin-#{$global-right}: $spacing;
+ margin-bottom: $spacing;
font-size: map-get($button-sizes, default);
@if $global-flexbox {
flex: 0 0 auto;
}
@@ -74,16 +76,18 @@
}
}
/// Creates a full-width button group, making each button equal width.
/// @param {String} $selector [$buttongroup-child-selector] - Selector for the buttons inside a button group.
+/// @param {Number} $spacing [$buttongroup-spacing] - Spacing between buttons in a button group.
@mixin button-group-expand(
$selector: $buttongroup-child-selector,
+ $spacing: $buttongroup-spacing,
$count: null
) {
@if not $global-flexbox {
- margin-#{$global-right}: -$buttongroup-spacing;
+ margin-#{$global-right}: -$spacing;
&::before,
&::after {
display: none;
}
@@ -92,18 +96,24 @@
#{$selector} {
@if $global-flexbox {
flex: 1 1 0px; // sass-lint:disable-line zero-unit
}
@else {
+ // One child
+ &:first-child:last-child {
+ width: 100%
+ }
+
+ // Two or more childreen
@for $i from 2 through $buttongroup-expand-max {
&:first-child:nth-last-child(#{$i}) {
&, &:first-child:nth-last-child(#{$i}) ~ #{$selector} {
display: inline-block;
- width: calc(#{percentage(1 / $i)} - #{$buttongroup-spacing});
- margin-#{$global-right}: $buttongroup-spacing;
+ width: calc(#{percentage(1 / $i)} - #{$spacing});
+ margin-#{$global-right}: $spacing;
&:last-child {
- margin-#{$global-right}: $buttongroup-spacing * -$buttongroup-expand-max;
+ margin-#{$global-right}: $spacing * -$buttongroup-expand-max;
}
}
}
}
}