2016-01-16 01:25:00 +03:00
// Implementation specification in https://github.com/FezVrasta/bootstrap-material-design/issues/822
2016-01-14 21:08:28 +03:00
// Drawer.
. mdb-layout-drawer {
position : absolute ;
2016-01-15 02:05:16 +03:00
z-index : 5 ; // over a header and content
2016-01-14 21:08:28 +03:00
box-sizing : border-box ;
display : flex ;
max-height : 100 % ;
flex-direction : column ;
flex-wrap : nowrap ;
overflow : visible ;
overflow-y : auto ;
2016-01-14 21:50:27 +03:00
color : $mdb-layout-drawer-text-color ;
2016-01-14 21:08:28 +03:00
background : $mdb-layout-drawer-bg-color ;
// Transform offscreen.
transition : transform ;
will-change : transform ;
transform-style : preserve-3d ;
@include shadow-2dp () ;
@include material-animation-default () ;
> * {
flex-shrink : 0 ;
}
. mdl-navigation {
flex-direction : column ;
align-items : stretch ;
padding-top : 1 rem ;
}
}
2016-01-15 02:05:16 +03:00
//----------------
// Sizing and positioning below here
//
// TODO create a mixin for the below that can generate a named set of styles so that you can use multiple drawer sizes i.e. something like mdb-layout-drawer-100, mdb-drawer-fixed-right-100, etc.
2016-01-15 20:38:29 +03:00
// These should definitely be passed in as args: $mdb-layout-drawer-x-overlay-breakpoint, $mdb-layout-drawer-size
2016-01-14 21:08:28 +03:00
2016-01-15 02:50:09 +03:00
// for left or right drawers, setup widths, heights and positions
@each $side in ( left right ) {
. mdb-drawer-fixed- #{ $side } {
> . mdb-layout-drawer {
// position
top : 0 ;
#{ $side } : 0 ;
width : $mdb-layout-drawer-size ;
height : 100 % ;
@if $side == left {
transform : translateX ( - $mdb-layout-drawer-size - 10 px ) ; // initial position of drawer (closed), way off screen
} @else {
transform : translateX ( $mdb-layout-drawer-size + 10 px ) ; // initial position of drawer (closed), way off screen
}
}
2016-01-14 21:08:28 +03:00
2016-01-15 02:50:09 +03:00
> . mdb-layout-content {
margin-#{$side} : 0 ;
}
2016-01-15 02:05:16 +03:00
}
}
2016-01-15 02:50:09 +03:00
// for top or bottom drawers, setup widths, heights and positions
@each $side in ( top bottom ) {
2016-01-15 22:53:30 +03:00
. mdb-drawer-fixed- #{ $side } { // style to force closed in all responsive cases
2016-01-15 02:50:09 +03:00
> . mdb-layout-drawer {
// position
#{ $side } : 0 ;
left : 0 ;
width : 100 % ;
height : $mdb-layout-drawer-size ;
@if $side == top {
transform : translateY ( - $mdb-layout-drawer-size - 10 px ) ; // initial position of drawer (closed), way off screen
} @else {
transform : translateY ( $mdb-layout-drawer-size + 10 px ) ; // initial position of drawer (closed), way off screen
}
}
2016-01-15 02:23:03 +03:00
2016-01-15 02:50:09 +03:00
> . mdb-layout-content {
margin-#{$side} : 0 ;
}
2016-01-15 02:23:03 +03:00
}
}
2016-01-15 02:05:16 +03:00
// Marker class for both triggering the opening of the drawer (i.e. javascript #addClass('.mdb-drawer-open')), as well
// as responsive sizes (i.e. mdb-drawer-open-md will open once the browser is wider than 768px).
//
2016-01-16 01:25:00 +03:00
//
// mdb-drawer-open, mdb-drawer-open-sm, mdb-drawer-open-md, mdb-drawer-open-lg
// We iterate over the standard grid breakpoints, but we also need styles for the simpler `mdb-drawer-open`
// without a size (for triggered openings). Since the xs size is 0, instead of using `mdb-drawer-open-xs`
// (which is mostly meaningless), we create `mdb-drawer-open` meaning always open.
//
// NOTE: mdb-drawer-open-* uses media-breakpoint-up()
//
2016-01-15 22:53:30 +03:00
//
// mdb-drawer-closed
2016-01-16 01:25:00 +03:00
// A marker class that will _force_ the drawer closed regardless of the responsive class present. If (for some
// strange reason) both mdb-drawer-closed and mdb-drawer-open are present, it appears that the closed option wins.
//
//
// mdb-drawer-overlay, mdb-drawer-overlay-sm, mdb-drawer-overlay-md, mdb-drawer-overlay-lg
// We iterate over the standard grid breakpoints, but we also need styles for the simpler `mdb-drawer-overlay`.
// Since the xs size is 0, instead of using `mdb-drawer-overlay-xs`, we create `mdb-drawer-overlay` meaning always overlay.
2016-01-15 22:53:30 +03:00
//
2016-01-16 01:25:00 +03:00
// NOTE: mdb-drawer-overlay-* uses media-breakpoint-down() - this is because we usually want a responsive overlay to be used in small screen scenarios.
//
//
// Drawer open positioning, and style options (push is default, overlay is optional)
// - first eliminate positioning or sizing rules if the drawer is already forced closed (which is the default behavior above)
: not ( . mdb-drawer-closed ) {
2016-01-15 02:05:16 +03:00
@each $breakpoint in map-keys ( $grid-breakpoints ) {
2016-01-16 01:25:00 +03:00
// e.g. &, &-sm, &-md, &-lg
2016-01-15 02:05:16 +03:00
$name : " &- #{ $breakpoint } " ;
@if $breakpoint == xs {
$name : " & " ;
}
2016-01-14 21:08:28 +03:00
2016-01-16 01:25:00 +03:00
& . mdb-drawer-open {
$name : " &- #{ $breakpoint } " ;
@if $breakpoint == xs {
$name : " & " ;
}
// e.g. &, &-sm, &-md, &-lg
#{ unquote ( $name ) } { // mdb-drawer-open, mdb-drawer-open-sm, mdb-drawer-open-md, mdb-drawer-open-lg
2016-01-15 22:53:30 +03:00
2016-01-16 01:25:00 +03:00
@include media-breakpoint-up ( $breakpoint ) {
2016-01-15 02:05:16 +03:00
2016-01-16 01:25:00 +03:00
// mdb-drawer-fixed-(left and right) styles
@each $side in ( left right ) {
2016-01-15 22:53:30 +03:00
2016-01-16 01:25:00 +03:00
& . mdb-drawer-fixed- #{ $side } {
2016-01-15 02:23:03 +03:00
2016-01-16 01:25:00 +03:00
// 1. Push - drawer will push the header and content (default behavior)
& ,
& . mdb-drawer-push {
> . mdb-layout-header {
width : calc ( 100 % - #{ $mdb-layout-drawer-size } ) ;
margin-#{$side} : $mdb-layout-drawer-size ;
}
> . mdb-layout-drawer {
transform : translateX ( 0 ) ;
}
> . mdb-layout-content {
margin-#{$side} : $mdb-layout-drawer-size ;
}
2016-01-15 23:56:11 +03:00
}
2016-01-16 01:25:00 +03:00
}
}
2016-01-15 02:23:03 +03:00
2016-01-16 01:25:00 +03:00
// mdb-drawer-fixed-(top and bottom) styles
@each $side in ( top bottom ) {
& . mdb-drawer-fixed- #{ $side } {
// 1. Push - drawer will push the header or content
> . mdb-layout-header {
//height: calc(100% - #{$mdb-layout-drawer-size});
@if $side == top { // only add margin-top on a header when the drawer is at the top
margin-#{$side} : $mdb-layout-drawer-size ;
}
2016-01-15 23:56:11 +03:00
}
2016-01-16 01:25:00 +03:00
> . mdb-layout-drawer {
transform : translateY ( 0 ) ;
2016-01-15 23:56:11 +03:00
}
2016-01-15 20:38:29 +03:00
> . mdb-layout-content {
2016-01-16 01:25:00 +03:00
@if $side == bottom { // only add margin-bottom on content when the drawer is at the bottom
margin-#{$side} : $mdb-layout-drawer-size ;
}
2016-01-15 20:38:29 +03:00
}
}
2016-01-15 02:50:09 +03:00
}
}
2016-01-15 23:56:11 +03:00
}
2016-01-16 01:25:00 +03:00
}
2016-01-15 23:56:11 +03:00
2016-01-16 01:25:00 +03:00
//
// Overlay - left/right responsive overlay classes and marker class
//
@mixin drawer-x-overlay ( $side ) {
> . mdb-layout-header ,
> . mdb-layout-content {
width : 100 % ;
margin-#{$side} : 0 ;
overflow : hidden ;
}
}
2016-01-16 01:30:10 +03:00
@mixin drawer-y-overlay ( $side ) {
> . mdb-layout-header ,
> . mdb-layout-content {
overflow : hidden ;
}
> . 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 01:25:00 +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
@each $side in ( left right ) {
& . mdb-drawer-fixed- #{ $side } {
2016-01-15 23:56:11 +03:00
2016-01-16 01:25:00 +03:00
@if $breakpoint == xs { // overlay marker class (non-responsive)
2016-01-15 23:56:11 +03:00
2016-01-16 01:25:00 +03:00
// Must double up on the .mdb-drawer-overlay class to increase specificity otherwise the
// responsive mdb-drawer-open-* media queries above win (and overlay is ignored)
& . mdb-drawer-overlay {
@include drawer-x-overlay ( $side )
2016-01-15 02:50:09 +03:00
}
2016-01-16 01:25:00 +03:00
} @else {
@include media-breakpoint-down ( $breakpoint ) { // overlay responsive class
@include drawer-x-overlay ( $side )
2016-01-15 02:50:09 +03:00
}
2016-01-15 02:23:03 +03:00
}
2016-01-15 02:05:16 +03:00
}
}
2016-01-16 01:25:00 +03:00
//// y - top/bottom
2016-01-16 01:30:10 +03:00
@each $side in ( top bottom ) {
& . mdb-drawer-fixed- #{ $side } {
@if $breakpoint == xs { // overlay marker class (non-responsive)
// Must double up on the .mdb-drawer-overlay class to increase specificity otherwise the
// responsive mdb-drawer-open-* media queries above win (and overlay is ignored)
& . mdb-drawer-overlay {
@include drawer-y-overlay ( $side )
}
} @else {
@include media-breakpoint-down ( $breakpoint ) { // overlay responsive class
@include drawer-y-overlay ( $side )
}
}
}
}
2016-01-15 02:05:16 +03:00
}
2016-01-14 21:08:28 +03:00
}
}
}