diff options
Split mixins
10 files changed, 177 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 | 53 | ||||
| -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..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 |