chore: separate mixins from definitions

This commit is contained in:
Kazhnuz 2021-07-30 09:47:18 +02:00
parent 7b882ecb6b
commit 04c0f11331
8 changed files with 118 additions and 115 deletions

View file

@ -36,108 +36,3 @@ $fontweight_hyper: 800;
$basefont: Open Sans, sans-serif; $basefont: Open Sans, sans-serif;
$titlefont: Amatic SC, sans-serif; $titlefont: Amatic SC, sans-serif;
// MIXINS RESPONSIVES
// Small tablets and large smartphones (landscape view)
$screen-sm-min: 576px;
// Small tablets (portrait view)
$screen-md-min: 768px;
// Tablets and small desktops
$screen-lg-min: 992px;
// Large tablets and desktops
$screen-xl-min: 1200px;
// Very large desktops
$screen-xxl-min: 1600px;
// Small devices
@mixin sm {
@media (min-width: #{$screen-sm-min}) {
@content;
}
}
// Medium devices
@mixin md {
@media (min-width: #{$screen-md-min}) {
@content;
}
}
// Large devices
@mixin lg {
@media (min-width: #{$screen-lg-min}) {
@content;
}
}
// Extra large devices
@mixin xl {
@media (min-width: #{$screen-xl-min}) {
@content;
}
}
// Extra large desktops
@mixin xxl {
@media (min-width: #{$screen-xxl-min}) {
@content;
}
}
// Custom devices
@mixin rwd($screen) {
@media (min-width: $screen+'px' ) {
@content;
}
}
// MIXINS AUTRES
@mixin borders() {
border: $border-size solid rgba(0, 0, 0, 0.3)
}
@mixin prefer-no-borders() {
&:not(:hover) {
border-color:transparent;
}
}
@mixin border-radius($border-radius) {
border-radius: $border-radius $border-radius $border-radius $border-radius;
}
@mixin shape-style($size) {
@include borders();
@include border-radius($btn-radius);
background-color:transparent;
// Biseau
position: relative;
z-index:1;
overflow: visible;
&:before {
content: " ";
position: absolute;
top:0;
left:-$size/2;
right:-$size/2;
bottom:0;
z-index:-1;
transform: skewX(-15deg);
}
}
@mixin colorize-shape($background-color) {
&:before {
background-color: $background-color;
}
}

7
src/scss/_mixins.scss Normal file
View file

@ -0,0 +1,7 @@
// MIXINS
// Include every mixins files
@import 'mixins/colors';
@import 'mixins/responsive';
@import 'mixins/borders';
@import 'mixins/shape';

View file

@ -46,6 +46,14 @@ $semantics: (
"success":"green", "success":"green",
"muted":"grey"); "muted":"grey");
@function get-color($name) {
@if map-has-key($semantics, $name) {
@return map-get($palette, map-get($semantics, $name));
} @else {
@return map-get($palette, $name);
}
}
// **Couleurs du theme** // **Couleurs du theme**
// Ne pas retirer ces couleurs, qui // Ne pas retirer ces couleurs, qui
// sont essentielle pour que le framework functionne. // sont essentielle pour que le framework functionne.

View file

@ -0,0 +1,15 @@
// BORDERS AND BORDERS RADIUS MIXINS
@mixin borders() {
border: $border-size solid rgba(0, 0, 0, 0.3)
}
@mixin prefer-no-borders() {
&:not(:hover) {
border-color:transparent;
}
}
@mixin border-radius($border-radius) {
border-radius: $border-radius $border-radius $border-radius $border-radius;
}

View file

@ -6,14 +6,6 @@
*/ */
// FUNCTIONS TO GET MORE EASILY COLORS // FUNCTIONS TO GET MORE EASILY COLORS
@function get-color($name) {
@if map-has-key($semantics, $name) {
@return map-get($palette, map-get($semantics, $name));
} @else {
@return map-get($palette, $name);
}
}
@function list-colors() { @function list-colors() {
$newmap: map-merge($palette, $semantics); $newmap: map-merge($palette, $semantics);
@return $newmap; @return $newmap;

View file

@ -0,0 +1,59 @@
// MIXINS RESPONSIVES
// Small tablets and large smartphones (landscape view)
$screen-sm-min: 576px;
// Small tablets (portrait view)
$screen-md-min: 768px;
// Tablets and small desktops
$screen-lg-min: 992px;
// Large tablets and desktops
$screen-xl-min: 1200px;
// Very large desktops
$screen-xxl-min: 1600px;
// Small devices
@mixin sm {
@media (min-width: #{$screen-sm-min}) {
@content;
}
}
// Medium devices
@mixin md {
@media (min-width: #{$screen-md-min}) {
@content;
}
}
// Large devices
@mixin lg {
@media (min-width: #{$screen-lg-min}) {
@content;
}
}
// Extra large devices
@mixin xl {
@media (min-width: #{$screen-xl-min}) {
@content;
}
}
// Extra large desktops
@mixin xxl {
@media (min-width: #{$screen-xxl-min}) {
@content;
}
}
// Custom devices
@mixin rwd($screen) {
@media (min-width: $screen+'px' ) {
@content;
}
}

View file

@ -0,0 +1,27 @@
@mixin shape-style($size) {
@include borders();
@include border-radius($btn-radius);
background-color:transparent;
// Biseau
position: relative;
z-index:1;
overflow: visible;
&:before {
content: " ";
position: absolute;
top:0;
left:-$size/2;
right:-$size/2;
bottom:0;
z-index:-1;
transform: skewX(-15deg);
}
}
@mixin colorize-shape($background-color) {
&:before {
background-color: $background-color;
}
}

View file

@ -21,10 +21,10 @@
@import 'palette'; @import 'palette';
@import 'colors';
@import 'definitions'; @import 'definitions';
@import 'mixins';
@import 'typography'; @import 'typography';
@import 'global'; @import 'global';