react-toolbox/components/button/style.scss

186 lines
3.9 KiB
SCSS
Raw Normal View History

@import "../base";
@import "../mixins";
@import "./config";
%button {
2015-11-21 14:23:24 +03:00
@include typo-button();
position: relative;
display: inline-block;
2015-10-07 10:56:34 +03:00
height: $button-height;
flex-direction: row;
align-content: center;
2015-10-21 01:48:24 +03:00
align-items: center;
justify-content: center;
text-align: center;
text-decoration: none;
white-space: nowrap;
cursor: pointer;
border: 0;
outline: none;
transition: box-shadow .2s $animation-curve-fast-out-linear-in,
background-color .2s $animation-curve-default,
color .2s $animation-curve-default;
&::-moz-focus-inner {
border: 0;
}
> span:not(.tooltip) {
display: inline-block;
line-height: $button-height;
vertical-align: middle;
}
> svg {
display: inline-block;
width: 1em;
height: 1em;
2015-11-25 00:18:00 +03:00
font-size: 120%;
vertical-align: middle;
fill: currentColor;
}
> * {
pointer-events: none;
}
2015-11-15 21:34:09 +03:00
[data-react-toolbox="ripple"] {
overflow: hidden;
2015-11-15 21:34:09 +03:00
}
2015-11-25 00:18:00 +03:00
&[disabled] {
color: $button-disabled-text-color;
pointer-events: none;
cursor: auto;
}
}
%squared {
2015-10-21 01:48:24 +03:00
min-width: $button-squared-min-width;
padding: $button-squared-padding;
border-radius: $button-border-radius;
.icon {
2015-10-21 01:48:24 +03:00
margin-right: $button-squared-icon-margin;
font-size: 120%;
vertical-align: middle;
}
> svg {
margin-right: .5 * $unit;
}
}
2015-11-25 00:18:00 +03:00
%solid {
&[disabled] {
@include shadow-2dp();
background-color: $button-disabled-background-color;
}
2015-11-25 00:18:00 +03:00
&:active {
@include shadow-4dp();
2015-10-06 23:08:37 +03:00
}
2015-11-25 00:18:00 +03:00
&:focus:not(:active) {
@include focus-shadow();
}
}
.raised {
@extend %button;
@extend %squared;
2015-11-25 00:18:00 +03:00
@extend %solid;
@include shadow-2dp();
2015-11-25 00:18:00 +03:00
}
.flat {
@extend %button;
@extend %squared;
background: transparent;
}
.floating {
@extend %button;
2015-11-25 00:18:00 +03:00
@extend %solid;
width: $button-floating-height;
height: $button-floating-height;
2015-10-21 01:48:24 +03:00
font-size: $button-floating-font-size;
border-radius: 50%;
2015-10-21 01:48:24 +03:00
box-shadow: 0 1px 1.5px 0 rgba(0, 0, 0, .12),
0 1px 1px 0 rgba(0, 0, 0, .24);
.icon {
line-height: $button-floating-height;
}
2015-11-15 23:42:32 +03:00
[data-react-toolbox="ripple"] {
border-radius: 50%;
}
2015-11-25 00:18:00 +03:00
&.mini {
width: $button-floating-mini-height;
height: $button-floating-mini-height;
font-size: $button-floating-mini-font-size;
.icon {
line-height: $button-floating-mini-height;
}
}
}
2015-11-24 02:29:02 +03:00
.toggle {
@extend %button;
width: $button-height;
background: transparent;
border-radius: 50%;
2015-11-25 00:18:00 +03:00
> .icon, svg {
2015-11-24 02:29:02 +03:00
font-size: $button-toggle-font-size;
line-height: $button-height;
vertical-align: middle;
}
[data-react-toolbox="ripple"] {
border-radius: 50%;
}
}
.neutral:not([disabled]) {
2015-11-22 09:01:49 +03:00
&:not(.inverse) {
&.raised, &.floating {
color: $button-neutral-color-contrast;
background-color: $button-neutral-color;
}
&.flat, &.toggle {
color: $button-neutral-color-contrast;
&:focus:not(:active) {
background: $button-neutral-color-hover;
}
}
2015-11-24 02:29:02 +03:00
&.flat:hover {
background: $button-neutral-color-hover;
}
}
2015-11-22 09:01:49 +03:00
&.inverse {
&.raised, &.floating {
color: $button-neutral-color;
background-color: $button-neutral-color-contrast;
}
2015-11-22 09:01:49 +03:00
&.flat, &.toggle {
color: $button-neutral-color;
&:focus:not(:active) {
background: $button-neutral-color-hover;
}
}
2015-11-24 02:29:02 +03:00
&.flat:hover {
background: $button-neutral-color-hover;
}
}
}
2015-11-25 00:18:00 +03:00
@mixin btn-colors($name, $color, $background, $hover) {
.#{$name}:not([disabled]) {
&.raised, &.floating {
color: $color;
background: $background;
}
&.flat, &.toggle {
color: $background;
&:focus:not(:active) {
background: $hover;
}
}
&.flat:hover {
background: $hover;
}
}
}
2015-11-25 00:18:00 +03:00
@include btn-colors('primary', $button-primary-color-contrast, $button-primary-color, $button-primary-color-hover);
@include btn-colors('accent', $button-accent-color-contrast, $button-accent-color, $button-accent-color-hover);