Skip to content

Commit

Permalink
rework button groups to not use borders
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Cochran committed Jan 19, 2016
1 parent 16eec87 commit 3cda91d
Showing 1 changed file with 21 additions and 22 deletions.
43 changes: 21 additions & 22 deletions scss/components/_button-group.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ $buttongroup-margin: 1rem !default;

/// Margin between buttons in a button group.
/// @type Border
$buttongroup-spacing: 1px !default;
$buttongroup-spacing: 10px !default;

/// Selector for the buttons inside a button group.
/// @type String
Expand All @@ -29,15 +29,17 @@ $buttongroup-expand-max: 6 !default;
) {
@include clearfix;
margin-bottom: $buttongroup-margin;
font-size: map-get($button-sizes, default);
font-size: 0;
&.tiny #{$child-selector} { font-size: map-get($button-sizes, tiny); }
&.small #{$child-selector} { font-size: map-get($button-sizes, small); }
&.large #{$child-selector} { font-size: map-get($button-sizes, large); }

#{$child-selector} {
float: #{$global-left};
margin: 0;
font-size: inherit;
font-size: map-get($button-sizes, default);

&:not(:last-child) {
border-#{$global-right}: $buttongroup-spacing solid $body-background;
margin-right: $buttongroup-spacing;
}
}
}
Expand All @@ -52,18 +54,18 @@ $buttongroup-expand-max: 6 !default;
@warn 'button-group-expand(): the $count property is no longer needed. This parameter will be removed in Foundation 6.2.';
}

display: table;
table-layout: fixed;
width: 100%;

&::before,
&::after {
display: none;
}
margin-right: -$buttongroup-spacing;

#{$selector} {
display: table-cell;
float: none;
@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-right: $buttongroup-spacing;
}
}
}
}
}

Expand All @@ -76,7 +78,7 @@ $buttongroup-expand-max: 6 !default;
width: 100%;

&:not(:last-child) {
border-#{$global-right}: $buttongroup-spacing solid;
margin-right: $buttongroup-spacing;
}
}
}
Expand All @@ -90,7 +92,7 @@ $buttongroup-expand-max: 6 !default;
width: auto;

&:not(:last-child) {
border-#{$global-right}: $buttongroup-spacing solid $body-background;
margin-right: $buttongroup-spacing;
}
}
}
Expand All @@ -99,10 +101,7 @@ $buttongroup-expand-max: 6 !default;
.button-group {
@include button-group;

// Sizes
&.tiny { font-size: map-get($button-sizes, tiny); }
&.small { font-size: map-get($button-sizes, small); }
&.large { font-size: map-get($button-sizes, large); }
// Even-width Group
&.expanded { @include button-group-expand; }

// Colors
Expand Down Expand Up @@ -137,7 +136,7 @@ $buttongroup-expand-max: 6 !default;

#{$buttongroup-child-selector} {
display: block;
border-right: 0;
margin-right: 0;
}
}
}
Expand Down

0 comments on commit 3cda91d

Please sign in to comment.