overleaf/services/web/frontend/stylesheets/components/buttons.less
Thomas 31cb9e336b Implement test to reduce compile timeout to 20 seconds (#14705)
Compile timeout reduction to 20s for treatment users

Co-authored-by: Rebeka <rebeka.dekany@overleaf.com>
GitOrigin-RevId: 54f70fe4b1fc631cef966deb0c1d28c904dd3a44
2023-09-19 08:03:52 +00:00

370 lines
8 KiB
Text
Executable file

//
// Buttons
// --------------------------------------------------
// Base styles
// --------------------------------------------------
.btn when(@is-new-css = false) {
display: inline-block;
margin-bottom: 0; // For input.btn
font-weight: @btn-font-weight;
text-align: center;
vertical-align: middle;
cursor: pointer;
background-image: none; // Reset unusual Firefox-on-Android default style; see https://github.com/necolas/normalize.css/issues/214
border: @btn-border-width solid transparent;
border-bottom: @btn-border-bottom-width 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 {
outline: 0;
background-image: none;
.box-shadow(inset 0 3px 5px rgba(0, 0, 0, 0.125));
}
&.disabled,
&[disabled],
fieldset[disabled] & {
cursor: not-allowed;
pointer-events: none; // Future-proof disabling of clicks
.opacity(0.65);
.box-shadow(none);
}
}
.btn when(@is-new-css = true) {
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 when (@is-new-css = false) {
.button-variant(@btn-primary-color; @btn-primary-bg; @btn-primary-border);
}
.btn-primary when (@is-new-css = true) {
.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 when(@is-new-css = false) {
.button-variant(@btn-danger-color; @btn-danger-bg; @btn-danger-border);
}
.btn-danger when(@is-new-css = true) {
.btn-borderless(@white, @red, @red-60);
}
// Danger Ghost and error appear as light red with no border
.btn-danger-ghost when (@is-new-css = false) {
.button-variant(@btn-danger-ghost-color; @btn-danger-ghost-bg; @btn-danger-ghost-border);
// hover for ghost acts different from typical variants, as it's default state has no bg
&:hover {
background-color: @red-10;
}
}
.btn-info-ghost when (@is-new-css = true) {
.btn-borderless(@blue-50, @btn-info-ghost-bg, @blue-10);
}
// Info Ghost appear as info blue with no border
.btn-info-ghost when (@is-new-css = false) {
.button-variant(@btn-info-ghost-color; @btn-info-ghost-bg; @btn-info-ghost-border);
// hover for ghost acts different from typical variants, as it's default state has no bg
&:hover {
background-color: @blue-10;
}
}
// Inline button to fit text, without link styling.
// TODO: generic class for other styles
.btn-info-ghost-inline when (@is-new-css = true) {
.btn-borderless(@blue-50, @btn-info-ghost-bg, @blue-10);
padding: 0 !important;
font-size: inherit !important;
vertical-align: inherit;
}
.btn-info-ghost-inline when (@is-new-css = false) {
.button-variant(@btn-info-ghost-color; @btn-info-ghost-bg; @btn-info-ghost-border);
// hover for ghost acts different from typical variants, as it's default state has no bg
&:hover {
background-color: @blue-10;
}
padding: 0 !important;
font-size: inherit !important;
vertical-align: inherit;
}
.btn-danger-ghost when (@is-new-css = true) {
.btn-borderless(@red-50, @btn-danger-ghost-bg, @red-10);
}
// btn-secondary
.btn-secondary when(@is-new-css = false) {
&:not(.btn-secondary-info) {
.btn-default;
}
}
.btn-secondary when(@is-new-css = true) {
.btn-bordered();
}
// btn-info for old and btn-secondary for new
.btn-secondary-info when(@is-new-css = false) {
.btn-info;
}
.btn-secondary-info when(@is-new-css = true) {
.btn-secondary;
}
// Buttons relating to premium features have a special background
.btn-premium {
.premium-background;
color: @white;
}
.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;
}
}
// 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
// --------------------------------------------------
.btn-xl {
.button-size(
@padding-large-vertical; @padding-large-horizontal; @font-size-h2;
@line-height-large; @btn-border-radius-large
);
}
.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 when(@is-new-css = true) {
.btn;
.btn-secondary;
position: relative;
padding-left: 20px;
padding-right: 0;
}
.login-btn when(@is-new-css = false) {
.btn;
.btn-default;
position: relative;
padding-left: 20px;
padding-right: 0;
}
.login-expand-more-btn {
display: list-item;
}