2017-11-18 12:06:44 +02:00
module . exports = {
id : 'drawer' ,
title : 'Menu drawer' ,
2017-11-19 12:11:11 +02:00
keywords : [ ` drawer ` , ` checkbox ` , ` toggle ` , ` close ` , ` drawer-toggle ` , ` drawer-close ` , ` menu ` , ` navigation ` , ` hamburger ` ] ,
description : ` <p>The drawer component of <strong>mini.css</strong> is used to create responsive navigation menus for your web apps. It is composed of three components - the drawer, the toggle button and the close button:</p>
< ul > < li > To create a drawer , simply create a checkbox input , applying the appropriate class to it ( < code > . drawer < / c o d e > ) , i m m e d i a t e l y f o l l o w e d b y a c o n t a i n e r o f y o u r l i k i n g ( e . g . a < c o d e > & l t ; d i v & g t ; < / c o d e > o r < c o d e > & l t ; n a v & g t ; < / c o d e > ) . T h e f o r m e r s e r v e s a s y o u r d r a w e r ' s c o n t r o l , w h i l e t h e l a t t e r i s t h e a c t u a l d r a w e r c o n t a i n e r . < / l i >
< li > Create a label anywhere outside your drawer ' s container for the checkbox controlling your drawer , applying the appropriate class ( < code > . drawer - toggle < / c o d e > ) . T h i s w i l l s e r v e a s t h e t o g g l e b u t t o n f o r y o u r d r a w e r m e n u . < / l i >
< li > Finally , inside your drawer ' s container , add another label for the checkbox controlling your drawer , applying the appropriate class ( < code > . drawer - close < / c o d e > ) . T h i s w i l l s e r v e a s t h e c l o s e b u t t o n f o r y o u r d r a w e r m e n u . < / l i >
< / u l > ` ,
example : ` <div style="height: 8rem; position: relative; text-align: center;"><br>
< style > . drawer + . demo { position : absolute ; height : 8 rem ; z - index : 0 ; top : 0 ; right : calc ( 0 rem - 320 px - 0.5 rem ) ; padding : 0.5 rem ; text - align : left ; } [ type = "checkbox" ] : checked . drawer + . demo { z - index : 1001 ; margin - right : 0.5 rem ; } < / s t y l e >
< label for = "demo-toggle" class = "button drawer-toggle persistent doc" > < / l a b e l >
< input type = "checkbox" id = "demo-toggle" class = "drawer persistent" > < div class = "demo doc" >
< label for = "demo-toggle" class = "drawer-close doc" > < / l a b e l > < a h r e f = " # " c l a s s = " d o c " > H o m e < / a > < b r / > < a h r e f = " # " c l a s s = " d o c " > N e w s < / a > < b r / >
< a href = "#" class = "doc" > About < /a><br/ > < a href = "#" class = "doc" > Contact < /a><br/ > < / d i v >
< / d i v > ` ,
samples : [
` <pre><span class="code-line"><span class="highlight-a"><label</span> <span class="highlight-b">for</span>=<span class="highlight-c">"drawer-control"</span> <span class="highlight-b">class</span>=<span class="highlight-c">"drawer-toggle"</span><span class="highlight-a">></label></span></span>
< span class = "code-line" > < / s p a n >
< span class = "code-line" > < span class = "highlight-a" > & lt ; input < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > t y p e < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; c h e c k b o x & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > i d < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; d r a w e r - c o n t r o l & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > c l a s s < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; d r a w e r & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - a " > & g t ; < / s p a n > < / s p a n >
< span class = "code-line" > < span class = "highlight-a" > & lt ; div & gt ; < / s p a n > < / s p a n >
< span class = "code-line" > < span class = "highlight-a" > & lt ; label < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > f o r < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; d r a w e r - c o n t r o l & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > c l a s s < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; d r a w e r - c l o s e & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - a " > & g t ; & l t ; / l a b e l & g t ; < / s p a n > < / s p a n >
< span class = "code-line" > < span class = "highlight-a" > & lt ; a < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > h r e f < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; # & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - a " > & g t ; < / s p a n > H o m e < s p a n c l a s s = " h i g h l i g h t - a " > & l t ; / a & g t ; < / s p a n > < / s p a n >
< span class = "code-line" > < span class = "highlight-a" > & lt ; / d i v & g t ; < / s p a n > < / s p a n > < / p r e > `
] ,
notes : [
` Drawer menus are responsive by default and will expand into normal containers on screens larger or equal to <code>768px</code> wide. ` ,
` It is highly recommended to place your drawer's toggle button inside your web app's header element. ` ,
` You can combine the navigation bar element with the drawer menu for better results. ` ,
` Remember to apply the appropriate classes to any and all elements, as indicated in the examples. Failing to do so will result in the drawer menu not rendering or behaving properly. `
] ,
2017-11-20 11:28:49 +02:00
customization : [
` Text color can be changed globally by changing the value of the <code>--fore-color</code> variable. This will affect the text color of the toggle button and items inside the drawer container. ` ,
` Background color for the drawer container can be changed by changing the value of the <code>--drawer-back-color</code> variable. ` ,
` Border color for the drawer container can be changed by changing the value of the <code>--drawer-border-color</code> variable. ` ,
` Text color for the drawer close button can be changed by changing the values of the <code>--drawer-close-color</code>. ` ,
` Background color for the drawer close button when focused or hovered over can be changed by changing the values of the <code>--drawer-hover-back-color</code>. ` ,
` Universal margin for elements can be changed globally by changing the value of the <code>--universal-margin</code> variable. As a rule of thumb, consider the universal margin to be the distance you want your paragraphs to have from the sides of the screen. ` ,
` Universal padding for elements can be changed globally by changing the value of the <code>--universal-padding</code> variable. ` ,
` Universal border radius for elements can be changed globally by changing the value of the <code>--universal-border-radius</code> variable. `
] ,
2017-11-19 12:11:11 +02:00
modifiers : [
{
title : ` Persistent drawer ` ,
description : ` <p>If you want your drawer menus to not expand into normal containers on larger screens, simply add the appropriate modifier (<code>.persistent</code>) on the checkbox controlling the drawer and its toggle button.</p> ` ,
example : ` ` ,
samples : [
` <pre><span class="code-line"><span class="highlight-a"><label</span> <span class="highlight-b">for</span>=<span class="highlight-c">"drawer-control"</span> <span class="highlight-b">class</span>=<span class="highlight-c">"drawer-toggle persistent"</span><span class="highlight-a">></label></span></span>
< span class = "code-line" > < / s p a n >
< span class = "code-line" > < span class = "highlight-a" > & lt ; input < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > t y p e < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; c h e c k b o x & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > i d < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; d r a w e r - c o n t r o l & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > c l a s s < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; d r a w e r p e r s i s t e n t & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - a " > & g t ; < / s p a n > < / s p a n >
< span class = "code-line" > < span class = "highlight-a" > & lt ; div & gt ; < / s p a n > < / s p a n >
< span class = "code-line" > < span class = "highlight-a" > & lt ; label < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > f o r < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; d r a w e r - c o n t r o l & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > c l a s s < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; d r a w e r - c l o s e & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - a " > & g t ; & l t ; / l a b e l & g t ; < / s p a n > < / s p a n >
< span class = "code-line" > < span class = "highlight-a" > & lt ; a < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > h r e f < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; # & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - a " > & g t ; < / s p a n > H o m e < s p a n c l a s s = " h i g h l i g h t - a " > & l t ; / a & g t ; < / s p a n > < / s p a n >
< span class = "code-line" > < span class = "highlight-a" > & lt ; / d i v & g t ; < / s p a n > < / s p a n > < / p r e > `
]
}
] ,
dos : [
{
description : ` You can combine the drawer menu with the <a href="#grid">grid system</a> to create responsive menus that are part of the layout of your web app. ` ,
sample : ` <pre><span class="code-line"><span class="highlight-a"><div</span> <span class="highlight-b">class</span>=<span class="highlight-c">"row"</span><span class="highlight-a">></span></span>
< span class = "code-line" > < span class = "highlight-a" > & lt ; input < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > t y p e < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; c h e c k b o x & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > i d < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; d r a w e r - c o n t r o l & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > c l a s s < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; d r a w e r & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - a " > & g t ; < / s p a n > < / s p a n >
< span class = "code-line" > < span class = "highlight-a" > & lt ; div < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > c l a s s < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; c o l - m d - 4 & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - a " > & g t ; < / s p a n > < / s p a n >
< span class = "code-line" > < span class = "highlight-a" > & lt ; label < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > f o r < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; d r a w e r - c o n t r o l & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > c l a s s < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; d r a w e r - c l o s e & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - a " > & g t ; & l t ; / l a b e l & g t ; < / s p a n > < / s p a n >
< span class = "code-line" > < span class = "highlight-a" > & lt ; a < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > h r e f < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; # & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - a " > & g t ; < / s p a n > H o m e < s p a n c l a s s = " h i g h l i g h t - a " > & l t ; / a & g t ; < / s p a n > < / s p a n >
< span class = "code-line" > < span class = "highlight-a" > & lt ; / d i v & g t ; < / s p a n > < / s p a n >
< span class = "code-line" > < span class = "highlight-a" > & lt ; div < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > c l a s s < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; c o l - s m - 1 2 c o l - m d - 8 & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - a " > & g t ; < / s p a n > < / s p a n >
< span class = "code-line" > < span class = "highlight-a" > & lt ; p & gt ; < / s p a n > P a g e c o n t e n t < s p a n c l a s s = " h i g h l i g h t - a " > & l t ; / p & g t ; < / s p a n > < / s p a n >
< span class = "code-line" > < span class = "highlight-a" > & lt ; / d i v & g t ; < / s p a n > < / s p a n >
< span class = "code-line" > < span class = "highlight-a" > & lt ; / d i v & g t ; < / s p a n > < / s p a n > < / p r e > `
}
] ,
donts : [
{
description : ` You should not place anything between the checkbox controlling the drawer and the container. ` ,
sample : ` <pre><span class="code-line"><span class="highlight-a"><input</span> <span class="highlight-b">type</span>=<span class="highlight-c">"checkbox"</span> <span class="highlight-b">id</span>=<span class="highlight-c">"drawer-control"</span> <span class="highlight-b">class</span>=<span class="highlight-c">"drawer"</span><span class="highlight-a">></span></span>
< span class = "code-line" > < span class = "highlight-c" > & lt ; ! -- Do not place other stuff between these -- & gt ; < / s p a n > < / s p a n >
< span class = "code-line" > < span class = "highlight-a" > & lt ; div & gt ; < / s p a n > < / s p a n >
< span class = "code-line" > < span class = "highlight-a" > & lt ; label < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > f o r < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; d r a w e r - c o n t r o l & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > c l a s s < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; d r a w e r - c l o s e & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - a " > & g t ; & l t ; / l a b e l & g t ; < / s p a n > < / s p a n >
< span class = "code-line" > < span class = "highlight-a" > & lt ; a < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > h r e f < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; # & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - a " > & g t ; < / s p a n > H o m e < s p a n c l a s s = " h i g h l i g h t - a " > & l t ; / a & g t ; < / s p a n > < / s p a n >
< span class = "code-line" > < span class = "highlight-a" > & lt ; / d i v & g t ; < / s p a n > < / s p a n > < / p r e > `
}
]
2017-11-18 12:06:44 +02:00
}