2015-11-25 01:34:17 +03:00
// specification: https://www.google.com/design/spec/components/buttons.html
// mdb default buttons are flat by default
2015-12-16 23:38:44 +03:00
. btn {
2015-11-02 23:39:13 +03:00
position : relative ;
2015-12-17 02:19:02 +03:00
margin-bottom : $mdb-btn-margin-bottom ; // just enough room so that focus shadows aren't covered up
2015-12-16 23:38:44 +03:00
font-size : $mdb-btn-font-size ;
2015-11-02 23:39:13 +03:00
text-decoration : none ;
2015-12-16 23:38:44 +03:00
text-transform : uppercase ;
letter-spacing : 0 ;
2015-12-07 22:34:46 +03:00
cursor : pointer ;
2015-12-16 23:38:44 +03:00
background-color : transparent ;
2015-12-07 22:34:46 +03:00
border : 0 ;
2015-12-24 20:36:39 +03:00
outline : 0 ;
2015-12-16 23:38:44 +03:00
box-shadow : none ;
2015-12-07 22:34:46 +03:00
transition : box-shadow 0 .2 s $mdb-animation-curve-fast-out-linear-in , background-color 0 .2 s $mdb-animation-curve-default , color 0 .2 s $mdb-animation-curve-default ;
will-change : box-shadow , transform ;
2015-12-17 02:19:02 +03:00
@include undo-bs-tab-focus () ;
2014-10-03 15:58:24 +04:00
2015-12-16 23:38:44 +03:00
//--
// Colors
2015-11-25 01:34:17 +03:00
2015-12-16 23:38:44 +03:00
// flat removes bg, add color variations to text
2015-12-28 21:44:05 +03:00
@include mdb-flat-button-color () ;
2015-11-25 01:34:17 +03:00
2015-12-17 19:00:17 +03:00
// fab and raised
// - colored, add their text and bg
// - hover color contrasted
// - shared shadow state on hover/active/focus
2015-12-23 23:12:39 +03:00
& . mdb-btn-fab ,
2015-12-16 23:38:44 +03:00
& . btn-raised ,
2015-12-09 00:08:18 +03:00
. btn-group-raised & {
2015-12-28 21:44:05 +03:00
@include mdb-raised-button-color () ;
2015-11-25 01:34:17 +03:00
2015-12-17 02:19:02 +03:00
// enlarged shadow on hover, focus
@include hover-focus () {
//border: 1px solid $blue;
2016-01-12 01:45:00 +03:00
z-index : 1 ; // add to the z-index so that the expanded shadow is above anything below it i.e. another button
2015-12-17 02:19:02 +03:00
@include shadow-4dp () ;
}
// :active - momentary press: big shadow, release and it is gone
// .active - persistent big shadow
& . active ,
& : active {
2016-01-12 01:45:00 +03:00
z-index : 1 ; // add to the z-index so that the expanded shadow is above anything below it i.e. another button
2015-12-17 02:19:02 +03:00
@include focus-shadow () ;
//border: 1px solid $green;
}
2015-12-17 19:00:17 +03:00
}
//---
// btn-raised
& . btn-raised ,
. btn-group-raised & {
// baseline shadow
@include shadow-2dp () ;
2015-11-25 01:34:17 +03:00
2015-12-17 02:19:02 +03:00
// reverse any of the above for links
& . btn-link {
box-shadow : none ;
@include mdb-hover-focus-active () {
box-shadow : none ;
2015-11-22 19:23:34 +03:00
}
}
2015-12-17 02:19:02 +03:00
@include mdb-disabled () {
box-shadow : none ;
}
2015-11-02 23:39:13 +03:00
}
2015-11-22 19:23:34 +03:00
2015-12-17 18:47:55 +03:00
// https://www.google.com/design/spec/components/buttons-floating-action-button.html
2016-01-08 01:17:34 +03:00
& . mdb-btn-fab ,
& . mdb-btn-icon {
padding : 0 ;
overflow : hidden ;
font-size : $mdb-btn-fab-font-size ;
line-height : normal ;
border-radius : 50 % ;
. btn-group-sm & {
padding : 0 ; // need specificity
}
. material-icons {
position : absolute ;
top : 50 % ;
left : 50 % ;
width : $mdb-btn-fab-font-size ;
line-height : $mdb-btn-fab-font-size ;
transform : translate ( - ( $mdb-btn-fab-font-size / 2 ) , - ( $mdb-btn-fab-font-size / 2 )) ;
}
}
2015-12-23 23:12:39 +03:00
& . mdb-btn-fab {
2015-11-25 01:34:17 +03:00
// see above for color variations
width : $mdb-btn-fab-size ;
2015-12-07 22:34:46 +03:00
min-width : $mdb-btn-fab-size ;
height : $mdb-btn-fab-size ;
2016-01-12 00:43:11 +03:00
//margin: auto;
2016-01-12 01:45:00 +03:00
//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.
2015-12-17 02:19:02 +03:00
box-shadow : 0 1 px 1 .5 px 0 $gray-lighter , 0 1 px 1 px 0 $gray-light ;
2014-10-03 15:58:24 +04:00
2015-11-25 01:34:17 +03:00
. ripple-container {
border-radius : 50 % ;
}
2014-10-03 15:58:24 +04:00
2015-12-23 23:12:39 +03:00
& . mdb-btn-fab-sm ,
2015-11-25 01:34:17 +03:00
. btn-group-sm & {
2016-01-08 01:17:34 +03:00
width : $mdb-btn-fab-size-sm ;
min-width : $mdb-btn-fab-size-sm ;
height : $mdb-btn-fab-size-sm ;
2016-01-12 01:45:00 +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.
2016-01-08 01:17:34 +03:00
//.material-icons {
// top: ($mdb-btn-icon-size-sm - $mdb-btn-fab-font-size) / 2;
// left: ($mdb-btn-icon-size-sm - $mdb-btn-fab-font-size) / 2;
//}
2015-11-25 01:34:17 +03:00
}
2016-01-08 01:17:34 +03:00
}
2014-10-03 15:58:24 +04:00
2016-01-08 01:17:34 +03:00
// Icon buttons
& . mdb-btn-icon {
width : $mdb-btn-icon-size ;
min-width : $mdb-btn-icon-size ;
height : $mdb-btn-icon-size ;
2016-01-12 00:43:11 +03:00
margin : 0 ;
2016-01-08 01:17:34 +03:00
color : inherit ;
& . mdb-btn-icon-sm ,
. btn-group-sm & {
width : $mdb-btn-icon-size-sm ;
min-width : $mdb-btn-icon-size-sm ;
height : $mdb-btn-icon-size-sm ;
. material-icons {
//$position: ($mdb-btn-icon-size-sm - $mdb-btn-icon-font-size-sm) / 2;
//top: $position;
//left: $position;
width : $mdb-btn-icon-font-size-sm ;
font-size : $mdb-btn-icon-font-size-sm ;
line-height : 1 ;
transform : translate ( - ( $mdb-btn-icon-font-size-sm / 2 ) , - ( $mdb-btn-icon-font-size-sm / 2 )) ;
}
2014-10-03 15:58:24 +04:00
}
2015-11-02 23:39:13 +03:00
}
2014-10-03 15:58:24 +04:00
2015-11-25 01:34:17 +03:00
// Align icons inside buttons with text
i . material-icons {
vertical-align : middle ;
}
2015-11-02 23:39:13 +03:00
// Size variations
2015-11-25 01:34:17 +03:00
& . btn-lg ,
. btn-group-lg & {
2016-01-14 00:42:48 +03:00
@include button-size ( $btn-padding-y-lg , $btn-padding-x-lg , $mdb-btn-font-size-lg , $line-height-lg , $btn-border-radius-lg ) ;
2015-11-25 01:34:17 +03:00
}
& . btn-sm ,
. btn-group-sm & {
2016-01-14 00:42:48 +03:00
@include button-size ( $btn-padding-y-sm , $btn-padding-x-sm , $mdb-btn-font-size-sm , $line-height-sm , $btn-border-radius-sm ) ;
2015-11-25 01:34:17 +03:00
font-size : $mdb-btn-font-size-sm ;
2015-11-02 23:39:13 +03:00
}
2015-11-25 01:34:17 +03:00
}
2014-10-03 15:58:24 +04:00
2015-11-25 01:34:17 +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
2015-12-17 02:19:02 +03:00
@include mdb-disabled () {
2015-12-16 23:38:44 +03:00
color : $mdb-btn-disabled ;
2015-12-21 22:27:44 +03:00
. bg-inverse & {
2015-12-28 21:44:05 +03:00
color : $mdb-inverse-btn-disabled ;
2014-10-03 15:58:24 +04:00
}
2015-11-25 01:34:17 +03:00
2015-12-16 23:38:44 +03:00
// flat buttons shouldn't lose transparency on disabled hover/focus
& ,
& : hover ,
& : focus {
background : transparent ;
}
2015-11-02 23:39:13 +03:00
}
2014-10-03 15:58:24 +04:00
}
2015-11-25 01:34:17 +03:00
// btn-group variations
. btn-group ,
. btn-group-vertical {
2015-11-02 23:39:13 +03:00
position : relative ;
margin : 10 px 1 px ;
2014-10-03 15:58:24 +04:00
2015-11-25 01:34:17 +03:00
// spec: https://www.google.com/design/spec/components/buttons.html#buttons-toggle-buttons
2015-12-28 21:44:05 +03:00
//&.open {
// .dropdown-toggle {
// }
//
// > .dropdown-toggle.btn {
// @include mdb-raised-button-color-bg();
// }
//}
2015-11-25 01:34:17 +03:00
. dropdown-menu {
2015-12-10 20:53:55 +03:00
border-radius : 0 0 $border-radius $border-radius ;
2015-11-02 23:39:13 +03:00
}
2015-11-25 01:34:17 +03:00
2015-11-02 23:39:13 +03:00
& . btn-group-raised {
2015-11-25 01:34:17 +03:00
@include shadow-2dp () ;
2015-11-02 23:39:13 +03:00
}
2015-11-25 01:34:17 +03:00
2015-12-07 22:34:46 +03:00
. btn + . btn ,
2015-11-25 01:34:17 +03:00
. btn ,
. btn : active ,
. btn-group {
2015-11-02 23:39:13 +03:00
margin : 0 ;
}
2014-10-03 15:58:24 +04:00
}