|
|
|
// mixins for button
|
|
|
|
// ------------------------
|
|
|
|
.button-size(@padding; @font-size; @border-radius) {
|
|
|
|
padding: @padding;
|
|
|
|
font-size: @font-size;
|
|
|
|
border-radius: @border-radius;
|
|
|
|
}
|
|
|
|
|
|
|
|
.button-variant(@color; @background; @border) {
|
|
|
|
.button-color(@color; @background; @border);
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
.button-color(tint(@color, 20%); tint(@background, 20%); tint(@border, 20%));
|
|
|
|
}
|
|
|
|
&:active,
|
|
|
|
&.active {
|
|
|
|
.button-color(shade(@color, 5%); shade(@background, 5%); shade(@background, 5%));
|
|
|
|
}
|
|
|
|
&:active,
|
|
|
|
&.active {
|
|
|
|
background-image: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
&.disabled,
|
|
|
|
&[disabled],
|
|
|
|
fieldset[disabled] & {
|
|
|
|
&,
|
|
|
|
&:hover,
|
|
|
|
&:active,
|
|
|
|
&.active {
|
|
|
|
.button-color(@btn-disable-color; @btn-disable-bg; @btn-disable-border);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.button-color(@color; @background; @border) {
|
|
|
|
color: @color;
|
|
|
|
background-color: @background;
|
|
|
|
border-color: @border;
|
|
|
|
}
|
|
|
|
|
|
|
|
.button-group-base(@btnClassName) {
|
|
|
|
position: relative;
|
|
|
|
display: inline-block;
|
|
|
|
vertical-align: middle;
|
|
|
|
> .@{btnClassName} {
|
|
|
|
position: relative;
|
|
|
|
float: left;
|
|
|
|
&:hover,
|
|
|
|
&:focus,
|
|
|
|
&:active,
|
|
|
|
&.active {
|
|
|
|
z-index: 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// size
|
|
|
|
&-lg > .@{btnClassName} {
|
|
|
|
.button-size(@btn-padding-lg; @btn-font-size-lg; @btn-border-radius-lg);
|
|
|
|
}
|
|
|
|
|
|
|
|
&-sm > .@{btnClassName} {
|
|
|
|
.button-size(@btn-padding-sm; @font-size-base; @btn-border-radius-sm);
|
|
|
|
> .@{iconfont-css-prefix} {
|
|
|
|
font-size: @font-size-base;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Base styles of buttons
|
|
|
|
// --------------------------------------------------
|
|
|
|
.btn() {
|
|
|
|
display: inline-block;
|
|
|
|
margin-bottom: 0;
|
|
|
|
font-weight: @btn-font-weight;
|
|
|
|
text-align: center;
|
|
|
|
vertical-align: middle;
|
|
|
|
touch-action: manipulation;
|
|
|
|
cursor: pointer;
|
|
|
|
background-image: none;
|
|
|
|
border: 1px solid transparent;
|
|
|
|
// outline: none;
|
|
|
|
white-space: nowrap;
|
|
|
|
line-height: @line-height-base;
|
|
|
|
.button-size(@btn-padding-base; @font-size-base; @btn-border-radius-base);
|
|
|
|
.user-select(none);
|
|
|
|
.transition(all .3s @ease-in-out);
|
|
|
|
transform: translate3d(0, 0, 0);
|
|
|
|
// Fix for ie8 border-radius
|
|
|
|
// http://css3pie.com/documentation/known-issues/#z-index
|
|
|
|
position: relative\0;
|
|
|
|
|
|
|
|
> .@{iconfont-css-prefix} {
|
|
|
|
line-height: 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
&,
|
|
|
|
&:active,
|
|
|
|
&:focus {
|
|
|
|
outline: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:not([disabled]):hover {
|
|
|
|
text-decoration: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:not([disabled]):active {
|
|
|
|
outline: 0;
|
|
|
|
.transition(none);
|
|
|
|
}
|
|
|
|
|
|
|
|
&.disabled,
|
|
|
|
&[disabled]{
|
|
|
|
cursor: @cursor-disabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
&-lg {
|
|
|
|
.button-size(@btn-padding-lg; @btn-font-size-lg; @btn-border-radius-lg);
|
|
|
|
}
|
|
|
|
|
|
|
|
&-sm {
|
|
|
|
.button-size(@btn-padding-sm; @font-size-base; @btn-border-radius-sm);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// primary button style
|
|
|
|
.btn-primary() {
|
|
|
|
.button-variant(@btn-primary-color; @btn-primary-bg; @primary-color);
|
|
|
|
|
|
|
|
&:hover,
|
|
|
|
&:active,
|
|
|
|
&.active {
|
|
|
|
color: @btn-primary-color;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// default button style
|
|
|
|
.btn-default() {
|
|
|
|
.button-variant(@btn-default-color; @btn-default-bg; @btn-default-border);
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
.button-color(tint(@primary-color, 20%); white; tint(@primary-color, 20%));
|
|
|
|
}
|
|
|
|
&:active,
|
|
|
|
&.active {
|
|
|
|
.button-color(shade(@primary-color, 5%); white; shade(@primary-color, 5%));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ghost button style
|
|
|
|
.btn-ghost() {
|
|
|
|
.button-variant(@btn-ghost-color, @btn-ghost-bg, @btn-ghost-border);
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
.button-color(tint(@primary-color, 20%); white; tint(@primary-color, 20%));
|
|
|
|
}
|
|
|
|
&:active,
|
|
|
|
&.active {
|
|
|
|
.button-color(shade(@primary-color, 5%); white; shade(@primary-color, 5%));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// circle button: the content only contains icon
|
|
|
|
.btn-circle(@btnClassName: btn) {
|
|
|
|
.square(@btn-circle-size);
|
|
|
|
.button-size(0; @font-size-base + 2; 50%);
|
|
|
|
|
|