2016-01-16 02:58:16 +03:00
|
|
|
// Mixins to allow creation of additional custom drawer sizes when using the defaults at the same time
|
|
|
|
//
|
2016-01-18 21:53:44 +03:00
|
|
|
|
|
|
|
//----
|
2016-01-20 00:41:30 +03:00
|
|
|
// Example 1: creates a media responsive kitchen-sink-drawer that pairs with mdb-drawer-in-lg and allows for the mdb-drawer-in trigger
|
2016-01-18 21:53:44 +03:00
|
|
|
//
|
2016-01-20 00:41:30 +03:00
|
|
|
// Used with <div class="mdb-layout-container mdb-drawer-pos-f-l mdb-drawer-overlay-md-down mdb-drawer-in-lg-up kitchen-sink-drawer">
|
|
|
|
//
|
|
|
|
//.kitchen-sink-drawer {
|
|
|
|
// @each $breakpoint in (xs lg) {
|
|
|
|
// // xs gives us the static marker class i.e. mdb-drawer-in, while lg gives us a responsive open/overlay
|
|
|
|
// @include mdb-drawer-x-closed(500px);
|
|
|
|
// @include mdb-drawer-x-open-up(500px, $breakpoint);
|
|
|
|
// }
|
|
|
|
// // Create a responsive overlay at mdb-drawer-overlay-md-down - this specificity is required
|
|
|
|
// @include mdb-drawer-x-overlay-down(md);
|
|
|
|
//}
|
2016-01-16 02:58:16 +03:00
|
|
|
//
|
2016-01-18 21:53:44 +03:00
|
|
|
//----
|
2016-01-20 00:41:30 +03:00
|
|
|
// Example 2: creates a NON-responsive kitchen-sink-drawer and allows for the mdb-drawer-in trigger
|
2016-01-16 02:58:16 +03:00
|
|
|
//
|
2016-01-19 23:56:33 +03:00
|
|
|
// Used with <div class="mdb-layout-container mdb-drawer-pos-f-l mdb-drawer-in kitchen-sink-drawer-triggered">
|
2016-01-16 02:58:16 +03:00
|
|
|
//
|
2016-01-20 00:41:30 +03:00
|
|
|
//.kitchen-sink-drawer-triggered {
|
|
|
|
// @include mdb-drawer-x-closed(500px); // closed by default
|
|
|
|
// @include mdb-drawer-x-open(500px); // triggered with mdb-drawer-in
|
|
|
|
// @include mdb-drawer-x-overlay(); // overlay by default, no other classes necessary
|
|
|
|
//}
|
2016-01-16 02:58:16 +03:00
|
|
|
|
2016-01-18 21:53:44 +03:00
|
|
|
@mixin mdb-drawer-x-closed($size) {
|
2016-01-19 23:56:33 +03:00
|
|
|
@each $side, $abbrev in (left: l, right: r) {
|
|
|
|
&.mdb-drawer-pos-f-#{$abbrev} {
|
2016-01-18 21:53:44 +03:00
|
|
|
> .mdb-layout-drawer {
|
|
|
|
// position
|
|
|
|
top: 0;
|
|
|
|
#{$side}: 0;
|
2016-01-16 02:58:16 +03:00
|
|
|
|
2016-01-18 21:53:44 +03:00
|
|
|
width: $size;
|
|
|
|
height: 100%;
|
|
|
|
|
|
|
|
@if $side == left {
|
|
|
|
transform: translateX(-$size - 10px); // initial position of drawer (closed), way off screen
|
|
|
|
} @else {
|
|
|
|
transform: translateX($size + 10px); // initial position of drawer (closed), way off screen
|
2016-01-16 02:58:16 +03:00
|
|
|
}
|
|
|
|
}
|
2016-01-18 21:53:44 +03:00
|
|
|
|
|
|
|
> .mdb-layout-content {
|
|
|
|
margin-#{$side}: 0;
|
|
|
|
}
|
2016-01-16 02:58:16 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-18 21:53:44 +03:00
|
|
|
@mixin mdb-drawer-y-closed($size) {
|
2016-01-19 23:56:33 +03:00
|
|
|
@each $side, $abbrev in (top: t, bottom: b) {
|
|
|
|
&.mdb-drawer-pos-f-#{$abbrev} {
|
2016-01-18 21:53:44 +03:00
|
|
|
> .mdb-layout-drawer {
|
|
|
|
// position
|
|
|
|
#{$side}: 0;
|
|
|
|
left: 0;
|
2016-01-16 02:58:16 +03:00
|
|
|
|
2016-01-18 21:53:44 +03:00
|
|
|
width: 100%;
|
|
|
|
height: $size;
|
|
|
|
|
|
|
|
@if $side == top {
|
|
|
|
transform: translateY(-$size - 10px); // initial position of drawer (closed), way off screen
|
|
|
|
} @else {
|
|
|
|
transform: translateY($size + 10px); // initial position of drawer (closed), way off screen
|
2016-01-16 02:58:16 +03:00
|
|
|
}
|
|
|
|
}
|
2016-01-18 21:53:44 +03:00
|
|
|
|
|
|
|
> .mdb-layout-content {
|
|
|
|
margin-#{$side}: 0;
|
|
|
|
}
|
2016-01-16 02:58:16 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-19 23:17:08 +03:00
|
|
|
@function mdb-drawer-breakpoint-name($breakpoint, $suffix: "") {
|
2016-01-16 02:58:16 +03:00
|
|
|
// e.g. &, &-sm, &-md, &-lg
|
2016-01-19 23:17:08 +03:00
|
|
|
$name: "&-#{$breakpoint}#{$suffix}";
|
2016-01-16 02:58:16 +03:00
|
|
|
@if $breakpoint == xs {
|
|
|
|
$name: "&";
|
|
|
|
}
|
|
|
|
@return $name;
|
|
|
|
}
|
|
|
|
|
|
|
|
@mixin mdb-drawer-x-open($size) {
|
2016-01-19 23:56:33 +03:00
|
|
|
@each $side, $abbrev in (left: l, right: r) {
|
|
|
|
&.mdb-drawer-pos-f-#{$abbrev} {
|
2016-01-16 02:58:16 +03:00
|
|
|
// Push - drawer will push the header and content (default behavior)
|
2016-01-19 02:39:37 +03:00
|
|
|
> .mdb-layout-header {
|
|
|
|
width: calc(100% - #{$size});
|
|
|
|
margin-#{$side}: $size;
|
|
|
|
}
|
2016-01-16 02:58:16 +03:00
|
|
|
|
2016-01-19 02:39:37 +03:00
|
|
|
> .mdb-layout-drawer {
|
|
|
|
transform: translateX(0);
|
|
|
|
}
|
2016-01-16 02:58:16 +03:00
|
|
|
|
2016-01-19 02:39:37 +03:00
|
|
|
> .mdb-layout-content {
|
|
|
|
margin-#{$side}: $size;
|
2016-01-16 02:58:16 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@mixin mdb-drawer-y-open($size) {
|
2016-01-19 23:56:33 +03:00
|
|
|
@each $side, $abbrev in (top: t, bottom: b) {
|
|
|
|
&.mdb-drawer-pos-f-#{$abbrev} {
|
2016-01-16 02:58:16 +03:00
|
|
|
|
|
|
|
// 1. Push - drawer will push the header or content
|
|
|
|
> .mdb-layout-header {
|
|
|
|
@if $side == top { // only add margin-top on a header when the drawer is at the top
|
|
|
|
margin-#{$side}: $size;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .mdb-layout-drawer {
|
|
|
|
transform: translateY(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
> .mdb-layout-content {
|
|
|
|
@if $side == bottom { // only add margin-bottom on content when the drawer is at the bottom
|
|
|
|
margin-#{$side}: $size;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// breakpoint based open to a particular size
|
|
|
|
@mixin mdb-drawer-x-open-up($size, $breakpoint) {
|
|
|
|
// e.g. &, &-sm, &-md, &-lg
|
2016-01-19 23:17:08 +03:00
|
|
|
$name: mdb-drawer-breakpoint-name($breakpoint, "-up");
|
2016-01-16 02:58:16 +03:00
|
|
|
|
2016-01-19 23:17:08 +03:00
|
|
|
&.mdb-drawer-in {
|
|
|
|
#{unquote($name)} { // mdb-drawer-in, mdb-drawer-in-sm, mdb-drawer-in-md, mdb-drawer-in-lg
|
2016-01-16 02:58:16 +03:00
|
|
|
|
2016-01-18 21:53:44 +03:00
|
|
|
@if $breakpoint == xs {
|
2016-01-19 23:17:08 +03:00
|
|
|
// mdb-drawer-in marker class (non-responsive)
|
2016-01-16 02:58:16 +03:00
|
|
|
@include mdb-drawer-x-open($size);
|
2016-01-18 21:53:44 +03:00
|
|
|
} @else {
|
|
|
|
|
|
|
|
// responsive class
|
|
|
|
@include media-breakpoint-up($breakpoint) {
|
2016-01-19 23:56:33 +03:00
|
|
|
// mdb-drawer-pos-f-(left and right) styles
|
2016-01-18 21:53:44 +03:00
|
|
|
@include mdb-drawer-x-open($size);
|
|
|
|
}
|
2016-01-16 02:58:16 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// breakpoint based open to a particular size
|
|
|
|
@mixin mdb-drawer-y-open-up($size, $breakpoint) {
|
|
|
|
// e.g. &, &-sm, &-md, &-lg
|
2016-01-19 23:17:08 +03:00
|
|
|
$name: mdb-drawer-breakpoint-name($breakpoint, "-up");
|
2016-01-16 02:58:16 +03:00
|
|
|
|
2016-01-19 23:17:08 +03:00
|
|
|
&.mdb-drawer-in {
|
|
|
|
#{unquote($name)} { // mdb-drawer-in, mdb-drawer-in-sm, mdb-drawer-in-md, mdb-drawer-in-lg
|
2016-01-16 02:58:16 +03:00
|
|
|
|
2016-01-18 21:53:44 +03:00
|
|
|
@if $breakpoint == xs {
|
2016-01-19 23:17:08 +03:00
|
|
|
// mdb-drawer-in marker class (non-responsive)
|
2016-01-16 02:58:16 +03:00
|
|
|
@include mdb-drawer-y-open($size);
|
2016-01-18 21:53:44 +03:00
|
|
|
} @else {
|
|
|
|
|
|
|
|
// responsive class
|
|
|
|
@include media-breakpoint-up($breakpoint) {
|
2016-01-19 23:56:33 +03:00
|
|
|
// mdb-drawer-pos-f-(left and right) styles
|
2016-01-18 21:53:44 +03:00
|
|
|
@include mdb-drawer-y-open($size);
|
|
|
|
}
|
2016-01-16 02:58:16 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-18 21:53:44 +03:00
|
|
|
@mixin mdb-drawer-x-overlay() {
|
2016-01-19 23:17:08 +03:00
|
|
|
@include mdb-layout-backdrop-in();
|
2016-01-19 02:39:37 +03:00
|
|
|
|
2016-01-19 23:56:33 +03:00
|
|
|
@each $side, $abbrev in (left: l, right: r) {
|
|
|
|
&.mdb-drawer-pos-f-#{$abbrev} {
|
2016-01-18 21:53:44 +03:00
|
|
|
> .mdb-layout-header,
|
|
|
|
> .mdb-layout-content {
|
|
|
|
width: 100%;
|
|
|
|
margin-#{$side}: 0;
|
|
|
|
}
|
|
|
|
}
|
2016-01-16 02:58:16 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-18 21:53:44 +03:00
|
|
|
@mixin mdb-drawer-y-overlay() {
|
2016-01-19 23:17:08 +03:00
|
|
|
@include mdb-layout-backdrop-in();
|
2016-01-19 02:39:37 +03:00
|
|
|
|
2016-01-19 23:56:33 +03:00
|
|
|
@each $side, $abbrev in (top: t, bottom: b) {
|
|
|
|
&.mdb-drawer-pos-f-#{$abbrev} {
|
2016-01-18 21:53:44 +03:00
|
|
|
> .mdb-layout-header {
|
|
|
|
@if $side == top { // only add margin-top on a header when the drawer is at the top
|
|
|
|
margin-#{$side}: 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .mdb-layout-content {
|
|
|
|
@if $side == bottom { // only add margin-bottom on content when the drawer is at the bottom
|
|
|
|
margin-#{$side}: 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-01-16 02:58:16 +03:00
|
|
|
}
|
2016-01-18 21:53:44 +03:00
|
|
|
}
|
2016-01-16 02:58:16 +03:00
|
|
|
|
2016-01-19 23:17:08 +03:00
|
|
|
// Overlay - left/right responsive overlay classes and marker class
|
2016-01-18 21:53:44 +03:00
|
|
|
@mixin mdb-drawer-x-overlay-down($breakpoint) {
|
|
|
|
// e.g. &, &-sm, &-md, &-lg
|
2016-01-19 23:17:08 +03:00
|
|
|
$name: mdb-drawer-breakpoint-name($breakpoint, '-down');
|
2016-01-18 21:53:44 +03:00
|
|
|
|
|
|
|
&.mdb-drawer-overlay {
|
|
|
|
#{unquote($name)} { // mdb-drawer-overlay, mdb-drawer-overlay-sm, mdb-drawer-overlay-md, mdb-drawer-overlay-lg
|
|
|
|
|
|
|
|
// x - left/right
|
|
|
|
|
|
|
|
@if $breakpoint == xs { // overlay marker class (non-responsive)
|
|
|
|
|
|
|
|
// Must double up on the .mdb-drawer-overlay class to increase specificity otherwise the
|
2016-01-19 23:17:08 +03:00
|
|
|
// responsive mdb-drawer-in-* media queries above win (and overlay is ignored)
|
2016-01-18 21:53:44 +03:00
|
|
|
&.mdb-drawer-overlay {
|
|
|
|
@include mdb-drawer-x-overlay()
|
|
|
|
}
|
|
|
|
} @else {
|
|
|
|
@include media-breakpoint-down($breakpoint) { // overlay responsive class
|
|
|
|
@include mdb-drawer-x-overlay()
|
|
|
|
}
|
|
|
|
}
|
2016-01-16 02:58:16 +03:00
|
|
|
}
|
|
|
|
}
|
2016-01-18 21:53:44 +03:00
|
|
|
}
|
2016-01-16 02:58:16 +03:00
|
|
|
|
2016-01-19 23:17:08 +03:00
|
|
|
// Overlay - top/bottom responsive overlay classes and marker class
|
2016-01-18 21:53:44 +03:00
|
|
|
@mixin mdb-drawer-y-overlay-down($breakpoint) {
|
|
|
|
// e.g. &, &-sm, &-md, &-lg
|
2016-01-19 23:17:08 +03:00
|
|
|
$name: mdb-drawer-breakpoint-name($breakpoint, "-down");
|
2016-01-18 21:53:44 +03:00
|
|
|
|
|
|
|
&.mdb-drawer-overlay {
|
|
|
|
#{unquote($name)} { // mdb-drawer-overlay, mdb-drawer-overlay-sm, mdb-drawer-overlay-md, mdb-drawer-overlay-lg
|
|
|
|
//// y - top/bottom
|
|
|
|
|
|
|
|
@if $breakpoint == xs { // overlay marker class (non-responsive)
|
|
|
|
|
|
|
|
// Must double up on the .mdb-drawer-overlay class to increase specificity otherwise the
|
2016-01-19 23:17:08 +03:00
|
|
|
// responsive mdb-drawer-in-* media queries above win (and overlay is ignored)
|
2016-01-18 21:53:44 +03:00
|
|
|
&.mdb-drawer-overlay {
|
|
|
|
@include mdb-drawer-y-overlay();
|
|
|
|
}
|
|
|
|
} @else {
|
|
|
|
@include media-breakpoint-down($breakpoint) { // overlay responsive class
|
|
|
|
@include mdb-drawer-y-overlay();
|
|
|
|
}
|
|
|
|
}
|
2016-01-16 02:58:16 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-01-18 21:53:44 +03:00
|
|
|
|