|
| 1 | +.button { |
| 2 | + @extend %base-font; |
| 3 | + align-items: center; |
| 4 | + background-color: map-get($button-default-type, background-color); |
| 5 | + border: solid px-to-rem(2px) map-get($button-default-type, background-color); |
| 6 | + border-radius: px-to-rem(5px); |
| 7 | + color: map-get($button-default-type, color); |
| 8 | + display: flex; |
| 9 | + justify-content: center; |
| 10 | + padding: px-to-rem(12px) px-to-rem(60px); |
| 11 | + |
| 12 | + &--is-loading { |
| 13 | + color: transparent !important; |
| 14 | + pointer-events: none; |
| 15 | + |
| 16 | + &::after { |
| 17 | + animation: button-spin 1.2s linear infinite; |
| 18 | + border: 0.2em solid map-get($button-default-type, color); |
| 19 | + border-radius: 50%; |
| 20 | + border-right-color: transparent; |
| 21 | + content: ''; |
| 22 | + display: block; |
| 23 | + height: 1.2em; |
| 24 | + position: absolute; |
| 25 | + width: 1.2em; |
| 26 | + } |
| 27 | + } |
| 28 | + |
| 29 | + &--is-inverse { |
| 30 | + background-color: transparent; |
| 31 | + color: map-get($button-default-type, background-color); |
| 32 | + |
| 33 | + &.button--is-loading::after { |
| 34 | + border-color: map-get($button-default-type, background-color); |
| 35 | + border-right-color: transparent; |
| 36 | + } |
| 37 | + } |
| 38 | + |
| 39 | + @each $type, $config in $button-types { |
| 40 | + &--is-#{$type} { |
| 41 | + background-color: map-get($config, background-color); |
| 42 | + border-color: map-get($config, background-color); |
| 43 | + color: map-get($config, color); |
| 44 | + |
| 45 | + &.button--is-loading::after { |
| 46 | + border-color: map-get($config, color); |
| 47 | + border-right-color: transparent; |
| 48 | + } |
| 49 | + |
| 50 | + &.button--is-inverse { |
| 51 | + background-color: transparent; |
| 52 | + color: map-get($config, background-color); |
| 53 | + |
| 54 | + &.button--is-loading::after { |
| 55 | + border-color: map-get($config, background-color); |
| 56 | + border-right-color: transparent; |
| 57 | + } |
| 58 | + } |
| 59 | + } |
| 60 | + } |
| 61 | + |
| 62 | + @keyframes button-spin { |
| 63 | + 0% { transform: rotate(0deg); } |
| 64 | + 100% { transform: rotate(360deg); } |
| 65 | + } |
| 66 | +} |
0 commit comments