diff options
Add Colors utilities #205
11 files changed, 354 insertions, 275 deletions
| -rw-r--r-- | src/mixins.less | 20 | ||||
| -rw-r--r-- | src/utilities.less | 281 | ||||
| -rw-r--r-- | src/utilities/colors.less | 45 | ||||
| -rw-r--r-- | src/utilities/display.less | 46 | ||||
| -rw-r--r-- | src/utilities/divider.less | 46 | ||||
| -rw-r--r-- | src/utilities/loading.less | 24 | ||||
| -rw-r--r-- | src/utilities/position.less | 90 | ||||
| -rw-r--r-- | src/utilities/shadow.less | 16 | ||||
| -rw-r--r-- | src/utilities/shapes.less | 7 | ||||
| -rw-r--r-- | src/utilities/text.less | 52 | ||||
| -rw-r--r-- | src/variables.less | 2 |
diff --git a/src/mixins.less b/src/mixins.less index f1d9c44..b161e0d 100644 --- a/src/mixins.less +++ b/src/mixins.less @@ -1,4 +1,5 @@ -// Core mixins +// Mixins +// Clearfix mixin .clearfix() { &::after { clear: both; @@ -37,6 +38,23 @@ color: @color; } +// Shadow mixin .shadow-variant(@offset) { box-shadow: 0 @offset (@offset+.1rem)*2 fade(@dark-color, 30%); } + +// Colors mixin +.text-color-variant(@color: @primary-color) { + color: @color; + + a& { + &:focus, + &:hover { + color: darken(@color, 5%); + } + } +} + +.bg-color-variant(@color: @primary-color) { + background: @color; +}
\ No newline at end of file diff --git a/src/utilities.less b/src/utilities.less index 2e4643a..03faaff 100644 --- a/src/utilities.less +++ b/src/utilities.less @@ -1,273 +1,8 @@ -// Divider -.divider, -.divider-vert { - display: block; - position: relative; - - &[data-content]::after { - background: @bg-color-light; - color: @gray-color-light; - content: attr(data-content); - display: inline-block; - font-size: @font-size-sm; - padding: 0 .8rem; - transform: translateY(-1.1rem); - } -} - -.divider { - border-top: @border-width solid @border-color; - height: .1rem; - margin: 1rem 0; -} - -.divider-vert { - display: block; - padding: @layout-padding; - - &::before { - border-left: @border-width solid @border-color; - bottom: @layout-padding; - content: ""; - display: block; - left: 50%; - position: absolute; - top: @layout-padding; - transform: translateX(-50%); - } - - &[data-content]::after { - left: 50%; - padding: .4rem 0; - position: absolute; - top: 50%; - transform: translate(-50%, -50%); - } -} - -// Loading -.loading { - color: transparent !important; - min-height: 1.6rem; - pointer-events: none; - position: relative; - &::after { - animation: loading 500ms infinite linear; - border: .2rem solid @primary-color; - border-radius: .8rem; - border-right-color: transparent; - border-top-color: transparent; - content: ""; - display: block; - height: 1.6rem; - left: 50%; - margin-left: -.8rem; - margin-top: -.8rem; - position: absolute; - top: 50%; - width: 1.6rem; - z-index: @zindex-0; - } -} - -// Position -.clearfix { - .clearfix(); -} -.float-left { - float: left !important; -} -.float-right { - float: right !important; -} - -.rel { - position: relative; -} -.abs { - position: absolute; -} -.fixed { - position: fixed; -} -.centered { - display: block; - float: none; - margin-left: auto; - margin-right: auto; -} - -// Spacing -.mt-10 { - margin-top: 1rem; -} -.mr-10 { - margin-right: 1rem; -} -.mb-10 { - margin-bottom: 1rem; -} -.ml-10 { - margin-left: 1rem; -} -.mt-5 { - margin-top: .5rem; -} -.mr-5 { - margin-right: .5rem; -} -.mb-5 { - margin-bottom: .5rem; -} -.ml-5 { - margin-left: .5rem; -} - -.pt-10 { - padding-top: 1rem; -} -.pr-10 { - padding-right: 1rem; -} -.pb-10 { - padding-bottom: 1rem; -} -.pl-10 { - padding-left: 1rem; -} -.pt-5 { - padding-top: .5rem; -} -.pr-5 { - padding-right: .5rem; -} -.pb-5 { - padding-bottom: .5rem; -} -.pl-5 { - padding-left: .5rem; -} - -// Display -.block { - display: block; -} -.inline { - display: inline; -} -.inline-block { - display: inline-block; -} -.flex { - display: flex; -} -.inline-flex { - display: inline-flex; -} -.hide { - display: none !important; -} -.visible { - visibility: visible; -} -.invisible { - visibility: hidden; -} -.text-hide { - background: transparent; - border: 0; - color: transparent; - font-size: 0; - line-height: 0; - text-shadow: none; -} -.text-assistive { - border: 0; - clip: rect(0,0,0,0); - height: .1rem; - margin: -.1rem; - overflow: hidden; - padding: 0; - position: absolute; - width: .1rem; -} -// Text -.text-left { - text-align: left; -} -.text-right { - text-align: right; -} -.text-center { - text-align: center; -} -.text-justify { - text-align: justify; -} - -.text-lowercase { - text-transform: lowercase; -} -.text-uppercase { - text-transform: uppercase; -} -.text-capitalize { - text-transform: capitalize; -} - -.text-normal { - font-weight: normal; -} -.text-bold { - font-weight: bold; -} -.text-italic { - font-style: italic; -} -.text-large { - font-size: 1.2em; -} - -.text-ellipsis { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} -.text-clip { - overflow: hidden; - text-overflow: clip; - white-space: nowrap; -} -.text-break { - hyphens: auto; - word-break: break-word; - word-wrap: break-word; -} -.hand { - cursor: pointer; -} - -// Shadow -.shadow-0 { - .shadow-variant(0); -} -.shadow-1 { - .shadow-variant(.1rem); -} -.shadow-2 { - .shadow-variant(.2rem); -} -.shadow-3 { - .shadow-variant(.3rem); -} -.shadow-4 { - .shadow-variant(.4rem); -} - -// Shapes -.rounded { - border-radius: @border-radius; -} -.circle { - border-radius: 50%; -} +@import 'utilities/colors.less'; +@import 'utilities/display.less'; +@import 'utilities/divider.less'; +@import 'utilities/loading.less'; +@import 'utilities/position.less'; +@import 'utilities/shadow.less'; +@import 'utilities/shapes.less'; +@import 'utilities/text.less';
\ No newline at end of file diff --git a/src/utilities/colors.less b/src/utilities/colors.less new file mode 100644 index 0000000..6a2691a --- /dev/null +++ b/src/utilities/colors.less @@ -0,0 +1,45 @@ +// Text colors +.text-primary { + .text-color-variant(@primary-color); +} +.text-secondary { + .text-color-variant(@secondary-color); +} +.text-gray { + .text-color-variant(@gray-color); +} +.text-light { + .text-color-variant(@light-color); +} +.text-success { + .text-color-variant(@control-color-success); +} +.text-warning { + .text-color-variant(@control-color-warning); +} +.text-error { + .text-color-variant(@control-color-error); +} + +// Background colors +.bg-primary { + .bg-color-variant(@primary-color); +} +.bg-secondary { + .bg-color-variant(@secondary-color); +} +.bg-dark { + .bg-color-variant(@dark-color); +} +.bg-gray { + .bg-color-variant(@bg-color); +} +.bg-success { + .bg-color-variant(@control-color-success); +} +.bg-warning { + .bg-color-variant(@control-color-warning); +} +.bg-error { + .bg-color-variant(@control-color-error); +} diff --git a/src/utilities/display.less b/src/utilities/display.less new file mode 100644 index 0000000..f6a54b5 --- /dev/null +++ b/src/utilities/display.less @@ -0,0 +1,46 @@ +// Display +.block { + display: block; +} +.inline { + display: inline; +} +.inline-block { + display: inline-block; +} +.flex { + display: flex; +} +.inline-flex { + display: inline-flex; +} +.hide { + display: none !important; +} +.visible { + visibility: visible; +} +.invisible { + visibility: hidden; +} +.text-hide { + background: transparent; + border: 0; + color: transparent; + font-size: 0; + line-height: 0; + text-shadow: none; +} +.text-assistive { + border: 0; + clip: rect(0,0,0,0); + height: .1rem; + margin: -.1rem; + overflow: hidden; + padding: 0; + position: absolute; + width: .1rem; +} +.hand { + cursor: pointer; +} diff --git a/src/utilities/divider.less b/src/utilities/divider.less new file mode 100644 index 0000000..fe30f68 --- /dev/null +++ b/src/utilities/divider.less @@ -0,0 +1,46 @@ +// Divider +.divider, +.divider-vert { + display: block; + position: relative; + + &[data-content]::after { + background: @bg-color-light; + color: @gray-color-light; + content: attr(data-content); + display: inline-block; + font-size: @font-size-sm; + padding: 0 .8rem; + transform: translateY(-1.1rem); + } +} + +.divider { + border-top: @border-width solid @border-color; + height: .1rem; + margin: 1rem 0; +} + +.divider-vert { + display: block; + padding: @layout-padding; + + &::before { + border-left: @border-width solid @border-color; + bottom: @layout-padding; + content: ""; + display: block; + left: 50%; + position: absolute; + top: @layout-padding; + transform: translateX(-50%); + } + + &[data-content]::after { + left: 50%; + padding: .4rem 0; + position: absolute; + top: 50%; + transform: translate(-50%, -50%); + } +} diff --git a/src/utilities/loading.less b/src/utilities/loading.less new file mode 100644 index 0000000..6f8b6e5 --- /dev/null +++ b/src/utilities/loading.less @@ -0,0 +1,24 @@ +// Loading +.loading { + color: transparent !important; + min-height: 1.6rem; + pointer-events: none; + position: relative; + &::after { + animation: loading 500ms infinite linear; + border: .2rem solid @primary-color; + border-radius: .8rem; + border-right-color: transparent; + border-top-color: transparent; + content: ""; + display: block; + height: 1.6rem; + left: 50%; + margin-left: -.8rem; + margin-top: -.8rem; + position: absolute; + top: 50%; + width: 1.6rem; + z-index: @zindex-0; + } +} diff --git a/src/utilities/position.less b/src/utilities/position.less new file mode 100644 index 0000000..c71af85 --- /dev/null +++ b/src/utilities/position.less @@ -0,0 +1,90 @@ +// Position +.clearfix { + .clearfix(); +} +.float-left { + float: left !important; +} +.float-right { + float: right !important; +} + +.rel { + position: relative; +} +.abs { + position: absolute; +} +.fixed { + position: fixed; +} +.centered { + display: block; + float: none; + margin-left: auto; + margin-right: auto; +} + +// Spacing +.mt-10 { + margin-top: 1rem; +} +.mr-10 { + margin-right: 1rem; +} +.mb-10 { + margin-bottom: 1rem; +} +.ml-10 { + margin-left: 1rem; +} +.m-10 { + margin: 1rem; +} +.mt-5 { + margin-top: .5rem; +} +.mr-5 { + margin-right: .5rem; +} +.mb-5 { + margin-bottom: .5rem; +} +.ml-5 { + margin-left: .5rem; +} +.m-5 { + margin: .5rem; +} + +.pt-10 { + padding-top: 1rem; +} +.pr-10 { + padding-right: 1rem; +} +.pb-10 { + padding-bottom: 1rem; +} +.pl-10 { + padding-left: 1rem; +} +.p-10 { + padding: 1rem; +} +.pt-5 { + padding-top: .5rem; +} +.pr-5 { + padding-right: .5rem; +} +.pb-5 { + padding-bottom: .5rem; +} +.pl-5 { + padding-left: .5rem; +} +.p-5 { + padding: .5rem; +} + diff --git a/src/utilities/shadow.less b/src/utilities/shadow.less new file mode 100644 index 0000000..9d8ff2a --- /dev/null +++ b/src/utilities/shadow.less @@ -0,0 +1,16 @@ +// Shadow +.shadow-0 { + .shadow-variant(0); +} +.shadow-1 { + .shadow-variant(.1rem); +} +.shadow-2 { + .shadow-variant(.2rem); +} +.shadow-3 { + .shadow-variant(.3rem); +} +.shadow-4 { + .shadow-variant(.4rem); +} diff --git a/src/utilities/shapes.less b/src/utilities/shapes.less new file mode 100644 index 0000000..e9f63bc --- /dev/null +++ b/src/utilities/shapes.less @@ -0,0 +1,7 @@ +// Shapes +.rounded { + border-radius: @border-radius; +} +.circle { + border-radius: 50%; +} diff --git a/src/utilities/text.less b/src/utilities/text.less new file mode 100644 index 0000000..f571613 --- /dev/null +++ b/src/utilities/text.less @@ -0,0 +1,52 @@ +// Text +.text-left { + text-align: left; +} +.text-right { + text-align: right; +} +.text-center { + text-align: center; +} +.text-justify { + text-align: justify; +} + +.text-lowercase { + text-transform: lowercase; +} +.text-uppercase { + text-transform: uppercase; +} +.text-capitalize { + text-transform: capitalize; +} + +.text-normal { + font-weight: normal; +} +.text-bold { + font-weight: bold; +} +.text-italic { + font-style: italic; +} +.text-large { + font-size: 1.2em; +} + +.text-ellipsis { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} +.text-clip { + overflow: hidden; + text-overflow: clip; + white-space: nowrap; +} +.text-break { + hyphens: auto; + word-break: break-word; + word-wrap: break-word; +} diff --git a/src/variables.less b/src/variables.less index 7bc1c72..63454ff 100644 --- a/src/variables.less +++ b/src/variables.less @@ -33,7 +33,7 @@ @secondary-color-light: lighten(@secondary-color, 3%); @link-color: @primary-color; -@link-color-dark: darken(@link-color, 10%); +@link-color-dark: darken(@link-color, 5%); // Gray colors @dark-color: #454d5d; |