diff options
Merge pull request #354 from picturepan2/0.5.0 v0.5.0
0.5.0
10 files changed, 189 insertions, 0 deletions
| -rw-r--r-- | src/mixins/_avatar.scss | 6 | ||||
| -rw-r--r-- | src/mixins/_button.scss | 51 | ||||
| -rw-r--r-- | src/mixins/_clearfix.scss | 8 | ||||
| -rw-r--r-- | src/mixins/_color.scss | 24 | ||||
| -rw-r--r-- | src/mixins/_label.scss | 11 | ||||
| -rw-r--r-- | src/mixins/_position.scss | 65 | ||||
| -rw-r--r-- | src/mixins/_shadow.scss | 9 | ||||
| -rw-r--r-- | src/mixins/_text.scss | 6 | ||||
| -rw-r--r-- | src/mixins/_toast.scss | 5 | ||||
| -rw-r--r-- | src/mixins/_transition.scss | 4 |
diff --git a/src/mixins/_avatar.scss b/src/mixins/_avatar.scss new file mode 100644 index 0000000..14617ad --- /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; +} diff --git a/src/mixins/_button.scss b/src/mixins/_button.scss new file mode 100644 index 0000000..338e8e3 --- /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; + } + } +} diff --git a/src/mixins/_clearfix.scss b/src/mixins/_clearfix.scss new file mode 100644 index 0000000..db6895f --- /dev/null +++ b/src/mixins/_clearfix.scss @@ -0,0 +1,8 @@ +// Clearfix mixin +@mixin clearfix() { + &::after { + clear: both; + content: ""; + display: table; + } +} diff --git a/src/mixins/_color.scss b/src/mixins/_color.scss new file mode 100644 index 0000000..f2e2e5c --- /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%); + } + } +} diff --git a/src/mixins/_label.scss b/src/mixins/_label.scss new file mode 100644 index 0000000..fad20c1 --- /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; +} diff --git a/src/mixins/_position.scss b/src/mixins/_position.scss new file mode 100644 index 0000000..0943469 --- /dev/null +++ b/src/mixins/_position.scss @@ -0,0 +1,65 @@ +// 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; + } +} diff --git a/src/mixins/_shadow.scss b/src/mixins/_shadow.scss new file mode 100644 index 0000000..7984449 --- /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); +} diff --git a/src/mixins/_text.scss b/src/mixins/_text.scss new file mode 100644 index 0000000..97dc99d --- /dev/null +++ b/src/mixins/_text.scss @@ -0,0 +1,6 @@ +// Text Ellipsis +@mixin text-ellipsis() { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} diff --git a/src/mixins/_toast.scss b/src/mixins/_toast.scss new file mode 100644 index 0000000..a7d3bbf --- /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; +} diff --git a/src/mixins/_transition.scss b/src/mixins/_transition.scss new file mode 100644 index 0000000..0b7497b --- /dev/null +++ b/src/mixins/_transition.scss @@ -0,0 +1,4 @@ +// Component transition +@mixin control-transition() { + transition: all .2s ease; +} |