@import "/imports/ui/stylesheets/variables/_all"; $btn-default-color: $color-gray; $btn-default-bg: $color-white; $btn-default-border: $color-white; $btn-primary-color: $color-white; $btn-primary-bg: $color-primary; $btn-primary-border: $color-primary; $btn-success-color: $color-white; $btn-success-bg: $color-success; $btn-success-border: $color-success; $btn-danger-color: $color-white; $btn-danger-bg: $color-danger; $btn-danger-border: $color-danger; $btn-border-size: $border-size; $btn-border-radius: $border-radius; $btn-font-weight: 600; $btn-spacing: .35rem; $btn-sm-font-size: $font-size-small * .85; $btn-sm-padding: $sm-padding-y $sm-padding-x; $btn-md-font-size: $font-size-base * .85; $btn-md-padding: $md-padding-y $md-padding-x; $btn-lg-font-size: $font-size-large * .85; $btn-lg-padding: $lg-padding-y $lg-padding-x; $btn-jumbo-font-size: 3rem; $btn-jumbo-padding: $jumbo-padding-y $jumbo-padding-x; /* Base * ========== */ .button { border: none; outline: none; overflow: visible; display: inline-block; border-radius: $border-size; font-weight: $btn-font-weight; line-height: 1; text-align: center; white-space: nowrap; vertical-align: middle; cursor: pointer; user-select: none; transition: all .2s ease-in-out; &:hover, &:focus { text-decoration: none; } &:active { background-image: none; outline: 0; } &[aria-disabled="true"] { cursor: not-allowed; opacity: .65; box-shadow: none; } &, &:active { &:focus { span:first-of-type::before { border-radius: $border-size; } } } } .buttonWrapper { border: none; overflow: visible !important; display: inline-block; outline: none; &, &:active { &:focus { span:first-of-type::before { border-radius: 50%; } } } line-height: 1.5; text-align: center; white-space: nowrap; vertical-align: middle; background: none; padding: 0 !important; &[aria-disabled="true"] > span { cursor: not-allowed; opacity: .65; box-shadow: none; } } .label { .buttonWrapper & { opacity: .85; display: block; margin-top: $btn-spacing; color: #fff; font-weight: normal; line-height: 1.5; text-align: center; white-space: nowrap; vertical-align: middle; } .buttonWrapper.sm & { display: inline-block; margin-top: 0; margin-left: $btn-spacing; } & + .icon, & + .button { margin-left: $btn-spacing; } &:hover { opacity: .5; } } .hideLabel { font-size: 0; height: 0; width: 0; margin: 0 !important; padding: 0 !important; overflow: hidden; display: block; } .icon { width: 1.28571429em; text-align: center; color: #fff; .buttonWrapper & { font-size: 125%; } & + .label { margin-left: $btn-spacing; } .buttonWrapper:hover & { opacity: .75; } } /* Colors * ========== */ @mixin button-variant($color, $background, $border) { $active-background: darken($background, 10%); $active-border: darken($border, 12%); color: $color; background-color: $background; border: $border-size-large solid transparent; &:focus, .buttonWrapper:focus:not([aria-disabled="true"]) & { outline: none !important; color: $color; background-color: $background; background-clip: padding-box; border: $border-size-large solid transparent; box-shadow: 0 0 0 $border-size $border; } &:hover, .buttonWrapper:hover & { color: $color; background-color: $active-background; border-color: $active-border; border: $border-size-large solid transparent; } } @mixin button-ghost-variant($color, $variant) { color: $color; background-image: none; background-color: transparent; border: $border-size-large solid transparent; &:focus, .buttonWrapper:focus & { color: $color; outline: none !important; background-color: $variant; background-clip: padding-box; border: $border-size-large solid transparent; box-shadow: 0 0 0 $border-size $color; } &:hover, .buttonWrapper:hover & { color: $color; background-color: $variant; border-color: $variant; border: $border-size-large solid transparent; } } .default { @include button-variant($btn-default-color, $btn-default-bg, $btn-primary-border); } .primary { @include button-variant($btn-primary-color, $btn-primary-bg, $btn-primary-border); } .success { @include button-variant($btn-success-color, $btn-success-bg, $btn-success-border); } .danger { @include button-variant($btn-danger-color, $btn-danger-bg, $btn-danger-border); } /* Styles * ========== */ .block { display: block; width: 100%; } .ghost { &.default { @include button-ghost-variant($btn-default-bg, $btn-default-color); } &.primary { @include button-ghost-variant($btn-primary-bg, $btn-primary-color); } &.success { @include button-ghost-variant($btn-success-bg, $btn-success-color); } &.danger { @include button-ghost-variant($btn-danger-bg, $btn-danger-color); } } .circle { $btn-sm-padding-x: nth($btn-sm-padding, 2) / 2.75; $btn-md-padding-x: nth($btn-md-padding, 2) / 2.75; $btn-lg-padding-x: nth($btn-lg-padding, 2) / 2.75; $btn-jumbo-padding-x: nth($btn-jumbo-padding, 2) / 2.75; border-radius: 50%; &.sm { padding-right: $btn-sm-padding-x; padding-left: $btn-sm-padding-x; } &.md { padding-right: $btn-md-padding-x; padding-left: $btn-md-padding-x; } &.lg { padding-right: $btn-lg-padding-x; padding-left: $btn-lg-padding-x; } &.jumbo { padding-right: $btn-jumbo-padding-x; padding-left: $btn-jumbo-padding-x; } } /* Sizes * ========== */ .sm { font-size: $btn-sm-font-size; padding: $btn-sm-padding; } .md { font-size: $btn-md-font-size; padding: $btn-md-padding; } .lg { font-size: $btn-lg-font-size; padding: $btn-lg-padding; } .jumbo { font-size: $btn-jumbo-font-size; padding: $btn-jumbo-padding; }