overleaf/services/web/frontend/stylesheets/components/buttons.less

283 lines
5.4 KiB
Text
Raw Normal View History

//
// Buttons
// --------------------------------------------------
// Base styles
// --------------------------------------------------
.btn {
display: inline-block;
margin-bottom: 0; // For input.btn
font-weight: @btn-font-weight;
text-align: center;
vertical-align: middle;
cursor: pointer;
border: 0 solid transparent;
white-space: nowrap;
.button-size(
@padding-base-vertical; @padding-base-horizontal; @font-size-base;
@line-height-base; @btn-border-radius-base
);
.user-select(none);
&,
&:active,
&.active {
&:focus {
.tab-focus();
}
}
&:hover,
&:focus {
color: @btn-default-color;
text-decoration: none;
}
// &:active,
// &.active {
// }
&.disabled,
&[disabled],
fieldset[disabled] & {
&,
&:hover,
&:focus,
&:active,
&.active {
cursor: not-allowed;
opacity: 1; //needed to override deprecated styling in individual classes
.box-shadow(none);
}
}
&.disabled.btn-info,
&.disabled.btn-default,
&[disabled].btn-info,
&[disabled].btn-default,
fieldset[disabled].btn-info,
fieldset[disabled].btn-default & {
// style only for deprecated classes
.opacity(0.65);
}
}
// Alternate buttons
// --------------------------------------------------
.btn-default {
.button-variant(@btn-default-color; @btn-default-bg; @btn-default-border);
}
.btn-default-outline {
.button-outline-variant(@btn-default-bg);
}
.btn-primary {
.btn-borderless();
}
.btn-primary-on-primary-bg {
.button-variant(@white; @ol-dark-green; @ol-dark-green);
}
// Success appears as green
.btn-success {
.btn-primary;
}
// Info appears as blue-green
.btn-info {
.button-variant(@btn-info-color; @btn-info-bg; @btn-info-border);
}
// Warning appears as orange
.btn-warning {
.button-variant(@btn-warning-color; @btn-warning-bg; @btn-warning-border);
}
// Danger and error appear as red
.btn-danger {
.btn-borderless(@white, @red, @red-60);
}
// Danger Ghost and error appear as light red with no border
.btn-danger-ghost {
.btn-borderless(@red-50, @btn-danger-ghost-bg, @red-10);
}
// Info Ghost appear as info blue with no border
.btn-info-ghost {
.btn-borderless(@blue-50, @btn-info-ghost-bg, @blue-10);
}
// Background Ghost appear as neutral-90 (matching our text colour) with no border
.btn-bg-ghost {
.btn-borderless(@neutral-90, @btn-info-ghost-bg, @neutral-10);
}
// Inline button to fit text, without link styling.
// TODO: generic class for other styles
.btn-info-ghost-inline {
.btn-borderless(@blue-50, @btn-info-ghost-bg, @blue-10);
padding: 0 !important;
font-size: inherit !important;
vertical-align: inherit;
}
// btn-secondary
.btn-secondary {
.btn-bordered();
}
.btn-secondary-info {
.btn-secondary;
}
// Buttons relating to premium features have a special background
.btn-premium {
.premium-background;
color: @white;
&:hover {
background: @blue-70;
}
}
.reset-btns {
// reset all buttons back to their original colors
.btn-danger {
.btn-danger;
}
.btn-default {
.btn-default;
}
.btn-default-outline {
.btn-default-outline;
}
.btn-info {
.btn-info;
}
.btn-primary {
.btn-primary;
}
.btn-success {
.btn-success;
}
.btn-warning {
.btn-warning;
}
.btn-secondary {
.btn-secondary;
}
.btn-premium {
.btn-premium;
}
}
// Link buttons
// -------------------------
// Make a button look and behave like a link
.btn-link {
color: @link-color;
font-weight: normal;
cursor: pointer;
border-radius: 0;
&,
&:active,
&[disabled],
fieldset[disabled] & {
background-color: transparent;
.box-shadow(none);
}
&,
&:hover,
&:focus,
&:active {
border-color: transparent;
}
&:hover,
&:focus {
color: @link-hover-color;
text-decoration: underline;
background-color: transparent;
}
&[disabled],
fieldset[disabled] & {
&:hover,
&:focus {
color: @btn-link-disabled-color;
text-decoration: none;
}
}
&.btn-danger {
color: @ol-red;
&:hover,
&:focus {
color: @ol-dark-red;
}
}
}
.btn-inline-link {
.btn-link();
padding: 0;
font-size: inherit;
vertical-align: inherit;
}
// Button Sizes
// --------------------------------------------------
2018-09-17 19:08:11 -04:00
.btn-xl {
.button-size(
@padding-large-vertical; @padding-large-horizontal; @font-size-h2;
@line-height-large; @btn-border-radius-large
);
2018-09-17 19:08:11 -04:00
}
.btn-lg {
// line-height: ensure even-numbered height of button next to large input
.button-size(
@padding-large-vertical; @padding-large-horizontal; @font-size-large;
@line-height-large; @btn-border-radius-large
);
}
.btn-sm {
// line-height: ensure proper height of button next to small input
.button-size(
@padding-small-vertical; @padding-small-horizontal; @font-size-small;
@line-height-small; @btn-border-radius-small
);
}
.btn-xs {
.button-size(
@padding-xs-vertical; @padding-xs-horizontal; @font-size-small;
@line-height-small; @btn-border-radius-small
);
}
// Block button
// --------------------------------------------------
.btn-block {
display: block;
width: 100%;
padding-left: 0;
padding-right: 0;
}
// Vertically space out multiple block buttons
.btn-block + .btn-block {
margin-top: 5px;
}
// Specificity overrides
input[type='submit'],
input[type='reset'],
input[type='button'] {
&.btn-block {
width: 100%;
}
}
.login-btn {
.btn;
.btn-secondary;
position: relative;
padding-left: 20px;
padding-right: 0;
}