2016-01-26 21:12:48 +03:00
// specification: https://www.google.com/design/spec/components/buttons.html
2016-03-28 21:29:45 +03:00
// bmd default buttons are flat by default
2016-01-26 21:12:48 +03:00
. btn {
position : relative ;
2016-03-28 23:18:19 +03:00
margin-bottom : $bmd-btn-margin-bottom ; // just enough room so that focus shadows aren't covered up
font-size : $bmd-btn-font-size ;
2016-01-26 21:12:48 +03:00
text-decoration : none ;
text-transform : uppercase ;
letter-spacing : 0 ;
cursor : pointer ;
background-color : transparent ;
border : 0 ;
outline : 0 ;
2017-08-11 17:59:31 +03:00
transition : box-shadow 0 .2 s $bmd-animation-curve-fast-out-linear-in ,
background-color 0 . 2s $ bmd-animation-curve-default ,
color 0 . 2s $ bmd-animation-curve-default ;
2016-01-26 21:12:48 +03:00
will-change : box-shadow , transform ;
//--
// Colors
// flat removes bg, add color variations to text
2016-03-21 17:56:51 +03:00
@include bmd-flat-button-color () ;
2016-01-26 21:12:48 +03:00
// fab and raised
// - colored, add their text and bg
// - hover color contrasted
// - shared shadow state on hover/active/focus
2016-03-21 17:56:51 +03:00
& . bmd-btn-fab ,
2016-01-26 21:12:48 +03:00
& . btn-raised ,
. btn-group-raised & {
2016-03-21 17:56:51 +03:00
@include bmd-raised-button-color () ;
2016-01-26 21:12:48 +03:00
// enlarged shadow on hover, focus
@include hover-focus () {
//border: 1px solid $blue;
z-index : 1 ; // add to the z-index so that the expanded shadow is above anything below it i.e. another button
2016-03-28 23:18:19 +03:00
@include box-shadow ( $bmd-shadow-4dp ) ;
2016-01-26 21:12:48 +03:00
}
// :active - momentary press: big shadow, release and it is gone
// .active - persistent big shadow
& . active ,
& : active {
z-index : 1 ; // add to the z-index so that the expanded shadow is above anything below it i.e. another button
2016-03-28 23:18:19 +03:00
@include box-shadow ( $bmd-shadow-focus ) ;
2016-01-26 21:12:48 +03:00
//border: 1px solid $green;
}
2017-09-25 15:29:14 +03:00
// :focus - Avoid outline/boxShadow on buttons after mouseup
& . focus ,
& : focus {
outline : 0 ; // disable outline
}
2016-01-26 21:12:48 +03:00
}
//---
// btn-raised
& . btn-raised ,
. btn-group-raised & {
// baseline shadow
2016-03-28 23:18:19 +03:00
@include box-shadow ( $bmd-shadow-2dp ) ;
2016-01-26 21:12:48 +03:00
// reverse any of the above for links
& . btn-link {
box-shadow : none ;
2016-03-21 17:56:51 +03:00
@include bmd-hover-focus-active () {
2016-01-26 21:12:48 +03:00
box-shadow : none ;
}
}
2016-03-21 17:56:51 +03:00
@include bmd-disabled () {
2016-01-26 21:12:48 +03:00
box-shadow : none ;
}
}
2016-08-03 19:49:32 +03:00
//---
// btn-outline
@include bmd-outline-button-color () ;
2016-01-26 21:12:48 +03:00
// https://www.google.com/design/spec/components/buttons-floating-action-button.html
2016-03-21 17:56:51 +03:00
& . bmd-btn-fab ,
& . bmd-btn-icon {
2016-01-26 21:12:48 +03:00
overflow : hidden ;
2016-03-28 23:18:19 +03:00
font-size : $bmd-btn-fab-font-size ;
2017-09-05 15:13:14 +03:00
line-height : 0 ;
2016-01-26 21:12:48 +03:00
2016-04-27 16:41:22 +03:00
. btn-group-lg & ,
2016-04-27 01:45:27 +03:00
. btn-group-sm & ,
& {
2016-01-26 21:12:48 +03:00
padding : 0 ; // need specificity
2016-04-27 01:45:27 +03:00
border-radius : 50 % ;
2017-09-05 15:13:14 +03:00
line-height : 0 ;
2016-01-26 21:12:48 +03:00
}
. material-icons {
position : absolute ;
top : 50 % ;
left : 50 % ;
2016-03-28 23:18:19 +03:00
width : $bmd-btn-fab-font-size ;
line-height : $bmd-btn-fab-font-size ;
2017-08-11 17:59:31 +03:00
transform : translate (
- ( $ bmd-btn-fab-font-size / 2 ) ,
- ( $ bmd-btn-fab-font-size / 2 )
) ;
2016-01-26 21:12:48 +03:00
}
}
2016-03-21 17:56:51 +03:00
& . bmd-btn-fab {
2016-01-26 21:12:48 +03:00
// see above for color variations
2016-03-28 23:18:19 +03:00
width : $bmd-btn-fab-size ;
min-width : $bmd-btn-fab-size ;
height : $bmd-btn-fab-size ;
2016-01-26 21:12:48 +03:00
//margin: auto;
//margin: 2px; // use z-index focus/hover/active instead. This is not called for in the spec, but it ensures room for the box-shadow, which is nice to have.
box-shadow : 0 1 px 1 .5 px 0 $gray-lighter , 0 1 px 1 px 0 $gray-light ;
. ripple-container {
border-radius : 50 % ;
}
2016-03-21 17:56:51 +03:00
& . bmd-btn-fab-sm ,
2016-01-26 21:12:48 +03:00
. btn-group-sm & {
2016-03-28 23:18:19 +03:00
width : $bmd-btn-fab-size-sm ;
min-width : $bmd-btn-fab-size-sm ;
height : $bmd-btn-fab-size-sm ;
2016-01-26 21:12:48 +03:00
//margin: 1px; // use z-index focus/hover/active instead. This is not called for in the spec, but it ensures room for the box-shadow, which is nice to have.
//.material-icons {
2016-03-28 21:29:45 +03:00
// top: ($bmd-btn-icon-size-sm - $bmd-btn-fab-font-size) / 2;
// left: ($bmd-btn-icon-size-sm - $bmd-btn-fab-font-size) / 2;
2016-01-26 21:12:48 +03:00
//}
}
}
// Icon buttons
2016-03-21 17:56:51 +03:00
& . bmd-btn-icon {
2016-03-28 23:18:19 +03:00
width : $bmd-btn-icon-size ;
min-width : $bmd-btn-icon-size ;
height : $bmd-btn-icon-size ;
2016-01-26 21:12:48 +03:00
margin : 0 ;
color : inherit ;
2016-08-05 22:24:52 +03:00
line-height : 0 ;
2016-01-26 21:12:48 +03:00
2016-03-21 17:56:51 +03:00
& . bmd-btn-icon-sm ,
2016-01-26 21:12:48 +03:00
. btn-group-sm & {
2016-03-28 23:18:19 +03:00
width : $bmd-btn-icon-size-sm ;
min-width : $bmd-btn-icon-size-sm ;
height : $bmd-btn-icon-size-sm ;
2016-04-27 01:45:27 +03:00
font-size : $bmd-btn-icon-font-size-sm ;
2016-01-26 21:12:48 +03:00
. material-icons {
2016-03-28 23:18:19 +03:00
width : $bmd-btn-icon-font-size-sm ;
font-size : $bmd-btn-icon-font-size-sm ;
2016-01-26 21:12:48 +03:00
line-height : 1 ;
2016-08-05 22:24:52 +03:00
vertical-align : middle ;
2017-08-11 17:59:31 +03:00
transform : translate (
- ( $ bmd-btn-icon-font-size-sm / 2 ) ,
- ( $ bmd-btn-icon-font-size-sm / 2 )
) ;
2016-01-26 21:12:48 +03:00
}
}
}
// Align icons inside buttons with text
2016-08-01 17:16:27 +03:00
. material-icons {
position : relative ;
2016-08-05 22:24:52 +03:00
display : inline-block ;
2016-08-01 17:16:27 +03:00
top : .25 em ;
margin-top : - 1 em ;
margin-bottom : - 1 em ;
font-size : 1 .5 em ;
2016-08-05 22:24:52 +03:00
vertical-align : middle ;
2016-01-26 21:12:48 +03:00
}
// Size variations
& . btn-lg ,
. btn-group-lg & {
2017-05-03 14:14:10 +03:00
@include button-size ( $input-btn-padding-y-lg , $input-btn-padding-x-lg , $bmd-btn-font-size-lg , $line-height-lg , $btn-border-radius-lg ) ;
2016-01-26 21:12:48 +03:00
}
& . btn-sm ,
. btn-group-sm & {
2017-05-03 14:14:10 +03:00
@include button-size ( $input-btn-padding-y-sm , $input-btn-padding-x-sm , $bmd-btn-font-size-sm , $line-height-sm , $btn-border-radius-sm ) ;
2016-03-28 23:18:19 +03:00
font-size : $bmd-btn-font-size-sm ;
2016-01-26 21:12:48 +03:00
}
}
// Disabled buttons and button groups
. btn ,
. input-group-btn . btn ,
. btn-group ,
. btn-group-vertical {
// have to ratchet up the specificity to kill drop shadows on disabled raised buttons
2016-03-21 17:56:51 +03:00
@include bmd-disabled () {
2016-03-28 23:18:19 +03:00
color : $bmd-btn-disabled ;
2016-01-26 21:12:48 +03:00
. bg-inverse & {
2016-03-28 23:18:19 +03:00
color : $bmd-inverse-btn-disabled ;
2016-01-26 21:12:48 +03:00
}
// flat buttons shouldn't lose transparency on disabled hover/focus
& ,
& : hover ,
& : focus {
background : transparent ;
}
}
}
// btn-group variations
. btn-group ,
. btn-group-vertical {
position : relative ;
margin : 10 px 1 px ;
// spec: https://www.google.com/design/spec/components/buttons.html#buttons-toggle-buttons
//&.open {
// .dropdown-toggle {
// }
//
// > .dropdown-toggle.btn {
2016-03-21 17:56:51 +03:00
// @include bmd-raised-button-color-bg();
2016-01-26 21:12:48 +03:00
// }
//}
. dropdown-menu {
border-radius : 0 0 $border-radius $border-radius ;
}
& . btn-group-raised {
2016-03-28 23:18:19 +03:00
@include box-shadow ( $bmd-shadow-2dp ) ;
2016-01-26 21:12:48 +03:00
}
. btn + . btn ,
. btn ,
. btn : active ,
. btn-group {
margin : 0 ;
}
2016-08-02 22:13:43 +03:00
// remove margin from nested btn-group(s) to properly align them with the outer buttons
> . btn-group {
margin : 0 ;
}
2016-01-26 21:12:48 +03:00
}