Summary Files Commits Branches @commit @diff @stats
path: root / src
diff options
context:
space:
mode:
Commitffd611d72ae26ad41a9eaa2589993c846768b6e0 (patch)
Author
 Yan Zhu <picturepan2@hotmail.com>
2017-12-07 14:25:15 +0800
Committer
 Yan Zhu <picturepan2@hotmail.com>
2017-12-07 14:25:15 +0800
Files4cb5a71ff45cdd5fbac93f8a37f8916559f3e943 /src
Spectre-Dark-Gruvbox-ffd611d72ae26ad41a9eaa2589993c846768b6e0.tar
Spectre-Dark-Gruvbox-ffd611d72ae26ad41a9eaa2589993c846768b6e0.tar.gz
Spectre-Dark-Gruvbox-ffd611d72ae26ad41a9eaa2589993c846768b6e0.zip
Parent57e1425dbcf13b7cd88790acd2267ced7291d09e (diff)
Split mixins
11 files changed, 187 insertions, 186 deletions
-rw-r--r--src/_mixins.scss196
-rw-r--r--src/mixins/_avatar.scss6
-rw-r--r--src/mixins/_button.scss51
-rw-r--r--src/mixins/_clearfix.scss8
-rw-r--r--src/mixins/_color.scss24
-rw-r--r--src/mixins/_label.scss11
-rw-r--r--src/mixins/_position.scss53
-rw-r--r--src/mixins/_shadow.scss9
-rw-r--r--src/mixins/_text.scss6
-rw-r--r--src/mixins/_toast.scss5
-rw-r--r--src/mixins/_transition.scss4
diff --git a/src/_mixins.scss b/src/_mixins.scss
index 18c4d47..54bed34 100644
--- a/src/_mixins.scss
+++ b/src/_mixins.scss
@@ -1,187 +1,11 @@
// Mixins
-// Avatar mixin
-@mixin avatar-base($size: $unit-8) {
- font-size: $size / 2;
- height: $size;
- width: $size;
-}
-
-// Background color utility mixin
-@mixin bg-color-variant($name: ".bg-primary", $color: $primary-color) {
- #{$name} {
- background: $color;
-
- @if (lightness($color) < 60) {
- color: $light-color;
- }
- }
-}
-
-// Button variant mixin
-@mixin button-variant($color: $primary-color) {
- background: $color;
- border-color: darken($color, 3%);
- color: $light-color;
- &:focus {
- @include control-shadow($color);
- }
- &:focus,
- &:hover {
- background: darken($color, 2%);
- border-color: darken($color, 5%);
- color: $light-color;
- }
- &:active,
- &.active {
- background: darken($color, 7%);
- border-color: darken($color, 10%);
- color: $light-color;
- }
- &.loading {
- @extend .btn-primary.loading;
- }
-}
-
-@mixin button-outline-variant($color: $primary-color) {
- background: $light-color;
- border-color: $color;
- color: $color;
- &:focus {
- @include control-shadow($color);
- }
- &:focus,
- &:hover {
- background: lighten($color, 50%);
- border-color: darken($color, 2%);
- color: $color;
- }
- &:active,
- &.active {
- background: $color;
- border-color: darken($color, 5%);
- color: $light-color;
- }
- &.loading {
- &::after {
- border-bottom-color: $color;
- border-left-color: $color;
- }
- }
-}
-
-// Clearfix mixin
-@mixin clearfix() {
- &::after {
- clear: both;
- content: "";
- display: table;
- }
-}
-
-// Component focus shadow
-@mixin control-shadow($color: $primary-color) {
- box-shadow: 0 0 0 .1rem rgba($color, .2);
-}
-
-// Component transition
-@mixin control-transition() {
- transition: all .2s ease;
-}
-
-// Label base style
-@mixin label-base() {
- border-radius: $border-radius;
- line-height: 1.2;
- padding: .1rem .15rem;
-}
-
-@mixin label-variant($color: $light-color, $bg-color: $primary-color) {
- background: $bg-color;
- color: $color;
-}
-
-// Margin utility mixin
-@mixin margin-variant($id: 1, $size: $unit-1) {
- .m-#{$id} {
- margin: $size;
- }
- .mb-#{$id} {
- margin-bottom: $size;
- }
- .ml-#{$id} {
- margin-left: $size;
- }
- .mr-#{$id} {
- margin-right: $size;
- }
- .mt-#{$id} {
- margin-top: $size;
- }
- .mx-#{$id} {
- margin-left: $size;
- margin-right: $size;
- }
- .my-#{$id} {
- margin-bottom: $size;
- margin-top: $size;
- }
-}
-
-// Padding utility mixin
-@mixin padding-variant($id: 1, $size: $unit-1) {
- .p-#{$id} {
- padding: $size;
- }
- .pb-#{$id} {
- padding-bottom: $size;
- }
- .pl-#{$id} {
- padding-left: $size;
- }
- .pr-#{$id} {
- padding-right: $size;
- }
- .pt-#{$id} {
- padding-top: $size;
- }
- .px-#{$id} {
- padding-left: $size;
- padding-right: $size;
- }
- .py-#{$id} {
- padding-bottom: $size;
- padding-top: $size;
- }
-}
-
-// Shadow mixin
-@mixin shadow-variant($offset) {
- box-shadow: 0 $offset ($offset + .05rem) * 2 rgba($dark-color, .3);
-}
-
-// Text color utility mixin
-@mixin text-color-variant($name: ".text-primary", $color: $primary-color) {
- #{$name} {
- color: $color;
- }
-
- a#{$name} {
- &:focus,
- &:hover {
- color: darken($color, 5%);
- }
- }
-}
-
-// Text Ellipsis
-@mixin text-ellipsis() {
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
-}
-
-// Toast variant mixin
-@mixin toast-variant($color: $dark-color) {
- background: rgba($color, .9);
- border-color: $color;
-}
+@import "mixins/avatar";
+@import "mixins/button";
+@import "mixins/clearfix";
+@import "mixins/color";
+@import "mixins/label";
+@import "mixins/position";
+@import "mixins/shadow";
+@import "mixins/text";
+@import "mixins/toast";
+@import "mixins/transition";
diff --git a/src/mixins/_avatar.scss b/src/mixins/_avatar.scss
new file mode 100644
index 0000000..bb9777a
--- /dev/null
+++ b/src/mixins/_avatar.scss
@@ -0,0 +1,6 @@
+// Avatar mixin
+@mixin avatar-base($size: $unit-8) {
+ font-size: $size / 2;
+ height: $size;
+ width: $size;
+} \ No newline at end of file
diff --git a/src/mixins/_button.scss b/src/mixins/_button.scss
new file mode 100644
index 0000000..b7c84d9
--- /dev/null
+++ b/src/mixins/_button.scss
@@ -0,0 +1,51 @@
+// Button variant mixin
+@mixin button-variant($color: $primary-color) {
+ background: $color;
+ border-color: darken($color, 3%);
+ color: $light-color;
+ &:focus {
+ @include control-shadow($color);
+ }
+ &:focus,
+ &:hover {
+ background: darken($color, 2%);
+ border-color: darken($color, 5%);
+ color: $light-color;
+ }
+ &:active,
+ &.active {
+ background: darken($color, 7%);
+ border-color: darken($color, 10%);
+ color: $light-color;
+ }
+ &.loading {
+ @extend .btn-primary.loading;
+ }
+}
+
+@mixin button-outline-variant($color: $primary-color) {
+ background: $light-color;
+ border-color: $color;
+ color: $color;
+ &:focus {
+ @include control-shadow($color);
+ }
+ &:focus,
+ &:hover {
+ background: lighten($color, 50%);
+ border-color: darken($color, 2%);
+ color: $color;
+ }
+ &:active,
+ &.active {
+ background: $color;
+ border-color: darken($color, 5%);
+ color: $light-color;
+ }
+ &.loading {
+ &::after {
+ border-bottom-color: $color;
+ border-left-color: $color;
+ }
+ }
+} \ No newline at end of file
diff --git a/src/mixins/_clearfix.scss b/src/mixins/_clearfix.scss
new file mode 100644
index 0000000..b3c78b0
--- /dev/null
+++ b/src/mixins/_clearfix.scss
@@ -0,0 +1,8 @@
+// Clearfix mixin
+@mixin clearfix() {
+ &::after {
+ clear: both;
+ content: "";
+ display: table;
+ }
+} \ No newline at end of file
diff --git a/src/mixins/_color.scss b/src/mixins/_color.scss
new file mode 100644
index 0000000..376688c
--- /dev/null
+++ b/src/mixins/_color.scss
@@ -0,0 +1,24 @@
+// Background color utility mixin
+@mixin bg-color-variant($name: ".bg-primary", $color: $primary-color) {
+ #{$name} {
+ background: $color;
+
+ @if (lightness($color) < 60) {
+ color: $light-color;
+ }
+ }
+}
+
+// Text color utility mixin
+@mixin text-color-variant($name: ".text-primary", $color: $primary-color) {
+ #{$name} {
+ color: $color;
+ }
+
+ a#{$name} {
+ &:focus,
+ &:hover {
+ color: darken($color, 5%);
+ }
+ }
+} \ No newline at end of file
diff --git a/src/mixins/_label.scss b/src/mixins/_label.scss
new file mode 100644
index 0000000..4dcb416
--- /dev/null
+++ b/src/mixins/_label.scss
@@ -0,0 +1,11 @@
+// Label base style
+@mixin label-base() {
+ border-radius: $border-radius;
+ line-height: 1.2;
+ padding: .1rem .15rem;
+}
+
+@mixin label-variant($color: $light-color, $bg-color: $primary-color) {
+ background: $bg-color;
+ color: $color;
+} \ No newline at end of file
diff --git a/src/mixins/_position.scss b/src/mixins/_position.scss
new file mode 100644
index 0000000..bbcadac
--- /dev/null
+++ b/src/mixins/_position.scss
@@ -0,0 +1,53 @@
+// Margin utility mixin
+@mixin margin-variant($id: 1, $size: $unit-1) {
+ .m-#{$id} {
+ margin: $size;
+ }
+ .mb-#{$id} {
+ margin-bottom: $size;
+ }
+ .ml-#{$id} {
+ margin-left: $size;
+ }
+ .mr-#{$id} {
+ margin-right: $size;
+ }
+ .mt-#{$id} {
+ margin-top: $size;
+ }
+ .mx-#{$id} {
+ margin-left: $size;
+ margin-right: $size;
+ }
+ .my-#{$id} {
+ margin-bottom: $size;
+ margin-top: $size;
+ }
+}
+
+// Padding utility mixin
+@mixin padding-variant($id: 1, $size: $unit-1) {
+ .p-#{$id} {
+ padding: $size;
+ }
+ .pb-#{$id} {
+ padding-bottom: $size;
+ }
+ .pl-#{$id} {
+ padding-left: $size;
+ }
+ .pr-#{$id} {
+ padding-right: $size;
+ }
+ .pt-#{$id} {
+ padding-top: $size;
+ }
+ .px-#{$id} {
+ padding-left: $size;
+ padding-right: $size;
+ }
+ .py-#{$id} {
+ padding-bottom: $size;
+ padding-top: $size;
+ }
+} \ No newline at end of file
diff --git a/src/mixins/_shadow.scss b/src/mixins/_shadow.scss
new file mode 100644
index 0000000..02ef8fb
--- /dev/null
+++ b/src/mixins/_shadow.scss
@@ -0,0 +1,9 @@
+// Component focus shadow
+@mixin control-shadow($color: $primary-color) {
+ box-shadow: 0 0 0 .1rem rgba($color, .2);
+}
+
+// Shadow mixin
+@mixin shadow-variant($offset) {
+ box-shadow: 0 $offset ($offset + .05rem) * 2 rgba($dark-color, .3);
+} \ No newline at end of file
diff --git a/src/mixins/_text.scss b/src/mixins/_text.scss
new file mode 100644
index 0000000..fcabcca
--- /dev/null
+++ b/src/mixins/_text.scss
@@ -0,0 +1,6 @@
+// Text Ellipsis
+@mixin text-ellipsis() {
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+} \ No newline at end of file
diff --git a/src/mixins/_toast.scss b/src/mixins/_toast.scss
new file mode 100644
index 0000000..1f0f9e5
--- /dev/null
+++ b/src/mixins/_toast.scss
@@ -0,0 +1,5 @@
+// Toast variant mixin
+@mixin toast-variant($color: $dark-color) {
+ background: rgba($color, .9);
+ border-color: $color;
+} \ No newline at end of file
diff --git a/src/mixins/_transition.scss b/src/mixins/_transition.scss
new file mode 100644
index 0000000..0c79d06
--- /dev/null
+++ b/src/mixins/_transition.scss
@@ -0,0 +1,4 @@
+// Component transition
+@mixin control-transition() {
+ transition: all .2s ease;
+} \ No newline at end of file