diff options
add button loading animations
3 files changed, 113 insertions, 1 deletions
| -rw-r--r-- | src/buttons.less | 104 | ||||
| -rw-r--r-- | src/utilities.less | 6 | ||||
| -rw-r--r-- | src/variables.less | 4 |
diff --git a/src/buttons.less b/src/buttons.less index 237eaa8..ae5b7d7 100644 --- a/src/buttons.less +++ b/src/buttons.less @@ -1 +1,103 @@ -// Buttons
\ No newline at end of file +// Buttons +.btn, +button { + display: inline-block; + padding: .7rem 1.5rem; + background-color: transparent; + border-radius: 3px; + color: @core-color; + font-size: 1.4rem; + line-height: 1.2; + text-align: center; + text-decoration: none; + vertical-align: middle; + border: 1px solid @core-color; + white-space: nowrap; + cursor: pointer; + user-select: none; + -webkit-appearance: none; + outline: 0; + + &:hover, + &:focus { + color: #fff; + background-color: @core-color; + } + &:active, + &.active { + color: #fff; + background-color: darken(@core-color, 5%); + } + + &.loading { + color: transparent !important; + pointer-events: none; + position: relative; + + &::after { + border: 2px solid @core-color; + border-right-color: transparent; + border-top-color: transparent; + border-radius: 8px; + content: ""; + position: absolute; + left: 50%; + top: 50%; + margin-left: -8px; + margin-top: -8px; + display: block; + width: 16px; + height: 16px; + animation: loading 500ms infinite linear; + } + } + + &[disabled] { + opacity: .5; + cursor: default; + } + + &.btn-primary { + color: #fff; + border-color: @core-color; + background-color: @core-color; + + &:hover, + &:focus { + color: #fff; + border-color: darken(@core-color, 5%); + background-color: darken(@core-color, 5%); + } + &:active, + &.active { + color: #fff; + border-color: darken(@core-color, 10%); + background-color: darken(@core-color, 10%); + } + + &.loading { + &::after { + border-color: #fff; + border-right-color: transparent; + border-top-color: transparent; + } + } + } + + &.btn-link { + color: @core-color; + border-color: transparent; + background-color: transparent; + + &:hover, + &:focus { + color: darken(@core-color, 15%); + } + &:active, + &.active { + color: darken(@core-color, 25%); + } + } + + // TODO: Button with icons +}
\ No newline at end of file diff --git a/src/utilities.less b/src/utilities.less index d49fe37..f3b4d89 100644 --- a/src/utilities.less +++ b/src/utilities.less @@ -98,4 +98,10 @@ } .circle { border-radius: 50%; +} + +// Animations +@keyframes loading { + 0%{transform: rotate(0deg);} + 100%{transform: rotate(360deg);} }
\ No newline at end of file diff --git a/src/variables.less b/src/variables.less index d4a8cb9..da3b46f 100644 --- a/src/variables.less +++ b/src/variables.less @@ -6,6 +6,10 @@ @body-font-size: 14px; @body-font-family: "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", WenQuanYi Micro Hei, sans-serif; +// Colors +@core-color: #5764C6; + + // Mixins .clearfix() { &::after { |