* Implement vertical linked button code.

pull/425/head
Megax 2016-05-11 10:26:58 +02:00
parent d3fcccc820
commit 57f66dc7b3
1 changed files with 108 additions and 5 deletions

View File

@ -27,8 +27,7 @@
@if $variant == 'light' { @if $variant == 'light' {
background-position: right 3px, right 4px; background-position: right 3px, right 4px;
} } @else {
@else {
background-position: right 3px, right 2px; background-position: right 3px, right 2px;
} }
@ -37,8 +36,7 @@
&:dir(rtl) { &:dir(rtl) {
@if $variant == 'light' { @if $variant == 'light' {
background-position: left 3px, left 4px; background-position: left 3px, left 4px;
} } @else {
@else {
background-position: left 3px, left 2px; background-position: left 3px, left 2px;
} }
} }
@ -72,6 +70,18 @@
} }
} }
%linked_vertical_middle {
border-radius: 0;
border-top-style: none;
border-bottom-style: solid;
&:dir(rtl) {
border-radius: 0; // needed when including %linked_vertical_middle:dir(rtl)
border-top-style: none;
border-bottom-style: solid;
}
}
%linked_button { %linked_button {
border-width: 1px; border-width: 1px;
border-style: solid; border-style: solid;
@ -116,6 +126,51 @@
border-radius: $roundness; border-radius: $roundness;
} }
} }
%linked_vertical_button {
border-width: 1px;
border-style: solid;
border-radius: 0;
border-top-style: none;
border-bottom-style: none;
&:first-child {
border-width: 1px;
border-radius: $roundness;
border-top-style: solid;
border-bottom-style: none;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
&:dir(rtl) {
border-top-style: none;
border-bottom-style: solid;
}
}
&:last-child {
border-width: 1px;
border-radius: $roundness;
border-top-style: none;
border-bottom-style: solid;
border-top-left-radius: 0;
border-top-right-radius: 0;
&:dir(rtl) {
border-top-style: solid;
border-bottom-style: none;
}
}
&:only-child, &:first-child:only-child {
border-width: 1px;
border-style: solid;
}
&:only-child {
border-radius: $roundness;
}
}
} }
@mixin linked_button($bg) { @mixin linked_button($bg) {
@ -165,6 +220,53 @@
} }
} }
@mixin linked_vertical_button($bg) {
$border_strength: if(lightness($bg) > 50, 0, .1);
$shadow_strength: if(lightness($bg) > 50, 0, .1);
@extend %linked_vertical_button;
box-shadow: inset 0 -1px border_normal(rgba(0, 0, 0, .12 + $border_strength)),
0 1px 2px -1px alpha($dark_shadow, .12 + $shadow_strength);
&:focus, &:hover {
box-shadow: inset 0 -1px border_focus(rgba(0, 0, 0, .12 + $border_strength)),
0 1px 2px -1px alpha($dark_shadow, .32 + $shadow_strength);
}
&:active, &:active:hover,
&:active:focus, &:active:hover:focus,
&:checked, &:checked:hover,
&:checked:focus, &:checked:hover:focus {
box-shadow: inset 0 -1px border_active(rgba(0, 0, 0, .12 + $border_strength)),
inset 1px 0 alpha($dark_shadow, .07),
inset -1px 0 alpha($dark_shadow, .05);
}
&:disabled { box-shadow: inset 0 -1px shade($bg, .8); }
&:last-child, &:only-child { box-shadow: 0 1px 2px -1px alpha($dark_shadow, .12 + $shadow_strength); }
&:last-child:hover, &:only-child:hover { box-shadow: 0 1px 2px -1px alpha($dark_shadow, .32 + $shadow_strength); }
&:disabled:last-child, &:disabled:only-child,
&:active:disabled:last-child, &:active:disabled:only-child,
&:checked:disabled:last-child, &:checked:disabled:only-child { box-shadow: none; }
&:active:last-child, &:active:last-child:focus, &:active:last-child:hover, &:active:last-child:hover:focus,
&:checked:last-child, &:checked:last-child:focus, &:checked:last-child:hover, &:checked:last-child:hover:focus {
box-shadow: inset 0 1px alpha($dark_shadow, .07),
inset -1px 0 alpha($dark_shadow, .06);
}
&:active:only-child, &:active:only-child:focus, &:active:only-child:hover, &:active:only-child:hover:focus,
&:checked:only-child, &:checked:only-child:focus, &:checked:only-child:hover, &:checked:only-child:hover:focus {
box-shadow: inset 1px 0 alpha($dark_shadow, .06),
inset 0 1px alpha($dark_shadow, .07),
inset -1px 0 alpha($dark_shadow, .06);
}
}
@mixin button($bg, $fg) { @mixin button($bg, $fg) {
$border_strength: if(lightness($bg) > 50, 0, .1); $border_strength: if(lightness($bg) > 50, 0, .1);
$shadow_strength: if(lightness($bg) > 50, 0, .1); $shadow_strength: if(lightness($bg) > 50, 0, .1);
@ -239,7 +341,6 @@
} }
@include exports("button") { @include exports("button") {
%close_button { %close_button {
border: 1px solid transparent; border: 1px solid transparent;
background-color: transparent; background-color: transparent;
@ -268,6 +369,8 @@
&.linked, .linked & { @include linked_button(shade($bg_color, 1.2)); } &.linked, .linked & { @include linked_button(shade($bg_color, 1.2)); }
&.linked.vertical, .linked.vertical & { @include linked_vertical_button(shade($bg_color, 1.2)); }
spinbutton & { spinbutton & {
color: mix($text_color, $base_color, .4); color: mix($text_color, $base_color, .4);
padding: $spacing ($spacing * 2); padding: $spacing ($spacing * 2);