Summary Files Commits Branches @commit @diff @stats
path: root / src
diff options
context:
space:
mode:
Commit8952210ff0063d1c7a10a8bbe837c7c73e4e3648 (patch)
Author
 Yan Zhu <picturepan2@hotmail.com>
2016-03-11 18:06:32 +0800
Committer
 Yan Zhu <picturepan2@hotmail.com>
2016-03-11 18:06:32 +0800
Files5e90d1ebc43ae7fbdb8a9759d8429b375363087d /src
Spectre-Dark-Gruvbox-8952210ff0063d1c7a10a8bbe837c7c73e4e3648.tar
Spectre-Dark-Gruvbox-8952210ff0063d1c7a10a8bbe837c7c73e4e3648.tar.gz
Spectre-Dark-Gruvbox-8952210ff0063d1c7a10a8bbe837c7c73e4e3648.zip
Parent1542ef242a0a4d629263c1a26621e6cd10b67a45 (diff)
add button loading animations
3 files changed, 113 insertions, 1 deletions
-rw-r--r--src/buttons.less104
-rw-r--r--src/utilities.less6
-rw-r--r--src/variables.less4
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 {