Skip to content

Instantly share code, notes, and snippets.

@md-riaz
Created October 5, 2020 04:06
Show Gist options
  • Save md-riaz/ab849dc3456fe5dc82fde29de6769abe to your computer and use it in GitHub Desktop.
Save md-riaz/ab849dc3456fe5dc82fde29de6769abe to your computer and use it in GitHub Desktop.
/* ===============
MIXINS
=============== */
@mixin flexProperties($prefix) {
.d#{$prefix}-flex {
display: flex !important;
}
.flex#{$prefix}-row {
flex-direction: row !important;
}
.flex#{$prefix}-column {
flex-direction: column !important;
}
.flex#{$prefix}-row-reverse {
flex-direction: row-reverse !important;
}
.flex#{$prefix}-column-reverse {
flex-direction: column-reverse !important;
}
.flex#{$prefix}-wrap {
flex-wrap: wrap !important;
}
.flex#{$prefix}-nowrap {
flex-wrap: nowrap !important;
}
.flex#{$prefix}-wrap-reverse {
flex-wrap: wrap-reverse !important;
}
.flex#{$prefix}-fill {
flex: 1 1 auto !important;
}
.flex#{$prefix}-grow-0 {
flex-grow: 0 !important;
}
.flex#{$prefix}-grow-1 {
flex-grow: 1 !important;
}
.flex#{$prefix}-shrink-0 {
flex-shrink: 0 !important;
}
.flex#{$prefix}-shrink-1 {
flex-shrink: 1 !important;
}
.justify-content#{$prefix}-start {
justify-content: flex-start !important;
}
.justify-content#{$prefix}-end {
justify-content: flex-end !important;
}
.justify-content#{$prefix}-center {
justify-content: center !important;
}
.justify-content#{$prefix}-between {
justify-content: space-between !important;
}
.justify-content#{$prefix}-around {
justify-content: space-around !important;
}
.align-items#{$prefix}-start {
align-items: flex-start !important;
}
.align-items#{$prefix}-end {
align-items: flex-end !important;
}
.align-items#{$prefix}-center {
align-items: center !important;
}
.align-items#{$prefix}-baseline {
align-items: baseline !important;
}
.align-items#{$prefix}-stretch {
align-items: stretch !important;
}
.align-content#{$prefix}-start {
align-content: flex-start !important;
}
.align-content#{$prefix}-end {
align-content: flex-end !important;
}
.align-content#{$prefix}-center {
align-content: center !important;
}
.align-content#{$prefix}-between {
align-content: space-between !important;
}
.align-content#{$prefix}-around {
align-content: space-around !important;
}
.align-content#{$prefix}-stretch {
align-content: stretch !important;
}
.align-self#{$prefix}-auto {
align-self: auto !important;
}
.align-self#{$prefix}-start {
align-self: flex-start !important;
}
.align-self#{$prefix}-end {
align-self: flex-end !important;
}
.align-self#{$prefix}-center {
align-self: center !important;
}
.align-self#{$prefix}-baseline {
align-self: baseline !important;
}
.align-self#{$prefix}-stretch {
align-self: stretch !important;
}
}
@mixin flexUtilites($breakpoints) {
@each $breakpoint_name, $breakpoint in $breakpoints {
@if ($breakpoint == 0) {
$prefix: "";
@include flexProperties($prefix);
} @else {
@media (min-width: $breakpoint) {
$prefix: -#{$breakpoint_name};
@include flexProperties($prefix);
}
}
}
}
/* Variables */
$breakpoints: (
0: 0,
sm: 576px,
md: 768px,
lg: 992px,
);
/* ==== Run mixins ====*/
@include flexUtilites($breakpoints);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment