overleaf/services/web/frontend/stylesheets/components/buttons.less
Thomas 24023dd267 Merge pull request #15901 from overleaf/tm-design-system-updates-teardown
Design system updates test tear down and clean up

GitOrigin-RevId: 743423f7c31c0ba89093bba0107d7e6799e1c309
2023-11-28 09:04:06 +00:00

276 lines
5.2 KiB
Text
Executable file

//
// 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);
}
// 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;
}
.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 {
.btn;
.btn-secondary;
position: relative;
padding-left: 20px;
padding-right: 0;
}
.login-expand-more-btn {
display: list-item;
}