Now can toggle the menu size (gstore.func.toggleMenuSize) @click on header icon

This commit is contained in:
xdrm-brackets 2017-12-04 11:48:32 +01:00
parent dc66a92169
commit 49ff17aa71
8 changed files with 50 additions and 9 deletions

View File

@ -15,6 +15,12 @@
/* background-color: rgba(0,0,0,.7); */ /* background-color: rgba(0,0,0,.7); */
color: #fff; color: #fff;
overflow: hidden;
cursor: pointer;
transition: all .2s ease-in-out;
} }
/* Header Icon > Title */ /* Header Icon > Title */
@ -136,4 +142,15 @@
#header-notif .hnotif[data-count='']:before, #header-notif .hnotif[data-count='']:before,
#header-notif .hnotif[data-count='0']:before{ #header-notif .hnotif[data-count='0']:before{
display: none; display: none;
}
/****************************/
/* Minified Header */
#WRAPPER.min #HEADER #header-icon{
width: calc( 3.5em - 3em );
background-position: center center;
} }

View File

@ -68,4 +68,6 @@ body{
flex-direction: column; flex-direction: column;
justify-content: flex-start; justify-content: flex-start;
flex-wrap: nowrap; flex-wrap: nowrap;
transition: width .2s ease-in-out;
} }

View File

@ -34,8 +34,8 @@
cursor: pointer; cursor: pointer;
transition: background-color .2s ease-in-out, transition: background-color .1s ease-in-out,
color .2s ease-in-out; color .2s ease-in-out;
} }
#MENU .menu-item:hover, #MENU .menu-item:hover,
@ -47,3 +47,14 @@
/****************************/ /****************************/
/* Minified Menu */
#WRAPPER.min #MENU{
width: calc( 3.5em - 1px );
}
#WRAPPER.min #MENU .menu-item-wrapper .menu-item{
background-position: center center;
background-size: 50%;
}

View File

@ -33,7 +33,6 @@ new Vue({
}) })
/* (3) Set WebSocket channels /* (3) Set WebSocket channels
---------------------------------------------------------*/ ---------------------------------------------------------*/
/* (1) Connection channel */ /* (1) Connection channel */
@ -77,4 +76,6 @@ window.wsc_chat = window.wsc.channel('chat').listen(function(msg, err){
// {3} Manage notification // // {3} Manage notification //
window.gstore.data.notif[1].data = window.gstore.data.notif[1].data.concat( msg.msg ); window.gstore.data.notif[1].data = window.gstore.data.notif[1].data.concat( msg.msg );
}).send({name: window._SERVER.session.name}); }).send({name: window._SERVER.session.name});

View File

@ -29,4 +29,11 @@ window.gstore.add('menu_item', {
icon: 'messages' icon: 'messages'
} }
}); });
window.gstore.add('menu_item_active', 'dashboard'); window.gstore.add('menu_item_active', 'dashboard');
window.gstore.add('min_menu', true);
// Functions
window.gstore.add('func', {
toggleMenuSize: function(){ window.gstore.data.min_menu=!window.gstore.data.min_menu; }
});

View File

@ -1,6 +1,6 @@
<template> <template>
<div id='HEADER'> <div id='HEADER' @click='gstore.func.toggleMenuSize'>
<!-- Header Icon+Title --> <!-- Header Icon+Title -->
<div id='header-icon'> <div id='header-icon'>

View File

@ -4,7 +4,9 @@
<div v-for='(item, index) in gstore.menu_item' class='menu-item-wrapper'> <div v-for='(item, index) in gstore.menu_item' class='menu-item-wrapper'>
<div :class="(index == gstore.menu_item_active) ? 'menu-item active' : 'menu-item'" @click='navigate_menu(index)' :style='"background-image: url(/image/menu/" + item.icon + ".svg@aaaaaa"'>{{ item.label }}</div> <div :class="(index == gstore.menu_item_active) ? 'menu-item active' : 'menu-item'" @click='navigate_menu(index)' :style='"background-image: url(/image/menu/" + item.icon + ".svg@aaaaaa"'>
<span v-show='!gstore.min_menu'>{{ item.label }}</span>
</div>
</div> </div>

View File

@ -1,5 +1,5 @@
<template> <template>
<div id="WRAPPER"> <div id="WRAPPER" :class='gstore.min_menu ? "min" : ""'>
<!-- Header --> <!-- Header -->
<header-comp></header-comp> <header-comp></header-comp>
@ -25,7 +25,8 @@ import menu_vue from './menu.vue';
export default { export default {
name: 'wrapper', name: 'wrapper',
data(){ return { data(){ return {
msg: 'Main vue component' msg: 'Main vue component',
gstore: window.gstore.data
}; }, }; },
components: { components: {
'HeaderComp': header_vue, 'HeaderComp': header_vue,