$base-class: "button"; @mixin button-focus-outline($offset: 2px) { outline-color: $core-focused-outline; outline-offset: $offset; outline-style: solid; outline-width: 2px; } @mixin button-variant($color, $hover: null, $active: null, $inverse: false) { background-color: $color; @if $inverse { padding: $pad-small; &:hover { background-color: rgba($core-fleet-black, 0.05); &:active { background-color: $ui-fleet-black-10; } } &:focus-visible { // need a slightly larger focus outline to accomodate the :after content box // that correctly displays the border. We chose this approach as adding a // border to the button caused the button to jump around on the screen // when it was added and removed. @include button-focus-outline($offset: 3px); &::after { content: ""; width: 100%; height: 100%; position: absolute; border: 1px solid $core-vibrant-blue; border-radius: 6px; } } } @else { &:hover:not(.button--disabled) { background-color: $hover; &:active { background-color: $active; } } &:focus-visible { @include button-focus-outline(); } } } .#{$base-class} { @include button-variant($core-vibrant-blue); transition: color 150ms ease-in-out, background 150ms ease-in-out, top 50ms ease-in-out, box-shadow 50ms ease-in-out, border 50ms ease-in-out; position: relative; color: $core-white; text-decoration: none; flex-direction: row; justify-content: center; align-items: center; padding: $pad-small $pad-medium; border-radius: 6px; font-size: $x-small; font-family: "Inter", sans-serif; font-weight: $bold; display: inline-flex; height: 38px; top: 0; border: 0; position: relative; cursor: pointer; &:focus { outline: none; } .transparent-text { opacity: 0; } .children-wrapper { display: flex; flex-direction: row; align-items: center; } &--default { @include button-variant( $core-vibrant-blue, $core-vibrant-blue-over, $core-vibrant-blue-down ); display: flex; text-wrap: nowrap; } &--success { @include button-variant($ui-success, $ui-success-over, $ui-success-down); display: flex; text-wrap: nowrap; } &--alert { @include button-variant( $core-vibrant-red, $core-vibrant-red-over, $core-vibrant-red-down ); display: flex; .loading-spinner { &__ring { div { border-color: $ui-error transparent transparent transparent; } } } } &--pill { @include button-variant( $ui-off-white, $core-vibrant-blue-over, null, $inverse: true ); color: $core-vibrant-blue; border: 1px solid $core-vibrant-blue; box-sizing: border-box; font-size: $xx-small; padding: $pad-xsmall 10px; height: 24px; white-space: nowrap; &:active { box-shadow: inset 2px 2px 2px rgba(0, 0, 0, 0.25); } &:hover, &:focus { border: 1px solid $core-vibrant-blue; } } &--text-link { @include button-variant(transparent); border: 0; box-shadow: none; color: $core-vibrant-blue; font-size: $x-small; cursor: pointer; margin: 0; padding: 0; height: auto; line-height: normal; text-align: left; &:focus { outline: none; } &:hover, &:focus { color: $core-vibrant-blue-over; background-color: transparent; box-shadow: none; text-decoration: underline; } &:active { color: $core-vibrant-blue-down; box-shadow: none; top: 0; } &.light-text { font-weight: $regular; } } &--text-link-dark { @include button-variant(transparent); border: 0; box-shadow: none; color: $core-fleet-black; font-size: $x-small; cursor: pointer; margin: 0; padding: 0; height: auto; line-height: normal; text-align: left; &:focus { outline: none; } &:hover, &:focus { background-color: transparent; box-shadow: none; text-decoration: underline; } &:active { box-shadow: none; top: 0; } } // &--icon is used for svg icon buttons without text &--text-icon, &--icon { @include button-variant(transparent); padding: 0; border: 0; box-shadow: none; color: $core-vibrant-blue; font-size: $x-small; font-weight: $bold; cursor: pointer; white-space: nowrap; img { transform: scale(0.5); } &:focus { outline: none; } &:focus-visible { @include button-focus-outline(); &::after { content: ""; width: 100%; height: 100%; position: absolute; border: 1px solid $core-vibrant-blue; border-radius: 6px; } } &:hover, &:focus { color: $core-vibrant-blue-over; svg { path { fill: $core-vibrant-blue-over; } } &:active { color: $core-vibrant-blue-down; svg { path { fill: $core-vibrant-blue-down; } } } // If .button--icon-stroke is present, use stroke instead of fill // Some SVG icons in these buttons contain a `stroke` instead of a `fill`, // so we need to modify that property instead. Adding a custom `fill` // could make these icons render incorrectly. &.button--icon-stroke { &:hover, &:focus { svg { path { fill: none; // Prevent fill from interfering stroke: $core-vibrant-blue-over; } } &:active { svg { path { stroke: $core-vibrant-blue-down; } } } } } } // globally styled gap between text and icon .children-wrapper { gap: $pad-small; } } &--icon { height: initial; // Override 38px height svg { padding: $pad-small; } } &--inverse { @include button-variant( $core-white, $core-vibrant-blue-over, $core-vibrant-blue-down, $inverse: true ); color: $core-vibrant-blue; box-sizing: border-box; .children-wrapper { gap: $pad-small; // For icons next to text like Pagination buttons } } &--inverse-alert { @include button-variant( $core-white, $core-vibrant-red-over, $core-vibrant-red-down, $inverse: true ); color: $core-vibrant-red; box-sizing: border-box; } &--disabled { @include disabled; } &--unstyled { @include button-variant(transparent); border: 0; box-shadow: none; color: $core-fleet-black; cursor: pointer; margin: 0; padding: 0; height: auto; line-height: normal; font-weight: normal; &:active { box-shadow: none; top: 0; } } &--unstyled-modal-query { @include button-variant(transparent); border: 0; box-shadow: none; color: $core-fleet-black; cursor: pointer; margin: 0; padding: 15px 12px; height: auto; line-height: normal; display: block; width: 100%; border-radius: 0px; border-bottom: 1px solid $ui-fleet-black-10; &:active { box-shadow: none; top: 0; } &:focus { outline: none; } &:hover, &:focus { background-color: $ui-vibrant-blue-10; box-shadow: none; } .children-wrapper { display: flex; width: 100%; flex-direction: column; gap: $pad-xsmall; align-items: flex-start; .info { &__header { display: block; text-align: left; } &__data { display: block; width: 100%; font-weight: normal; text-align: left; } } } } &--oversized { background-color: $core-fleet-black; padding: $pad-large $pad-small; font-size: $medium; width: 100%; } }