[design] improve menu layout with tabs

This commit is contained in:
Kuldeep M 2019-01-04 16:24:05 +00:00
parent 6776a6ad50
commit a87148ce5c
4 changed files with 243 additions and 147 deletions

View File

@ -1,43 +1,83 @@
.menu {
background-color: var(--gray-02);
border-radius: var(--radius);
padding: calc(var(--gutter) * 4);
position: fixed;
bottom: 1em;
left: 1em;
width: calc(100% - 2em);
max-height: calc(60vh - 2em);
height: calc(70vh - 2em);
overflow-y: scroll;
z-index: 3000;
display: grid;
/* grid-template-columns: repeat(1, minmax(1em, 1fr)); */
grid-template-columns: repeat(auto-fill, minmax(12em, 1fr));
transform: translateY(calc(100% + 2em));
transition: transform var(--animation-speed-fast) ease-in-out;
grid-gap: calc(var(--gutter) * 8);
/* display: grid;
grid-template-columns: repeat(auto-fit, minmax(20em, 1fr));
grid-gap: var(--line-width); */
}
.is-menu-open .menu {
transform: translateY(0);
}
.menu-item {
position: relative;
.menu-nav:not(:last-child) {
margin: 0;
}
.menu-item:not(:first-child):before {
/* content: "";
border-left: 1px solid var(--gray-04);
position: absolute;
top: 0;
left: -2em;
width: calc(100% + 1px);
height: calc(100% + 1px);
pointer-events: none; */
.menu-area {
display: none;
}
.menu-area.active {
display: block;
}
.menu-nav-button {
margin: 0;
padding: 1.5em 2em;
border-radius: 0;
}
.menu-nav-button.active {
background-color: var(--gray-04);
color: var(--white);
}
.menu-content {
padding: 2em;
}
.menu-sub-area {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(14em, 1fr));
grid-gap: 2em;
}
.menu-header {
border-top: var(--line-width) solid var(--gray-04);
padding-top: 1em;
}
@media (min-width: 550px) {
.menu {
height: calc(70vh - 2em);
}
.menu-nav {
display: flex;
}
}
@media (min-width: 900px) {
.menu {
max-height: calc(80vh - 2em);
height: calc(50vh - 2em);
}
.menu-nav {
display: flex;
}
.menu-sub-area {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(20em, 1fr));
}
}

View File

@ -81,135 +81,167 @@
</section>
<section class="menu">
<div class="menu-item">
<h1>Header</h1>
<h2>Clock</h2>
<div class="checkbox-wrap">
<input id="control-header-clock-active" class="control-header-clock-active" type="checkbox" tabindex="1">
<label for="control-header-clock-active"><span class="label-icon"></span>Show</label>
<ul class="menu-nav u-list-unstyled">
<li class="menu-nav-item">
<button class="menu-nav-button button button-block button-large active" data-target=".menu-area-header">Header</button>
</li>
<li class="menu-nav-item">
<button class="menu-nav-button button button-block button-large" data-target=".menu-area-bookmarks">Bookmarks</button>
</li>
<li class="menu-nav-item">
<button class="menu-nav-button button button-block button-large" data-target=".menu-area-layout">Layout</button>
</li>
</ul>
<div class="menu-content">
<div class="menu-area menu-area-header active">
<div class="menu-sub-area">
<div class="menu-item">
<h1 class="menu-header">Clock</h1>
<div class="checkbox-wrap">
<input id="control-header-clock-active" class="control-header-clock-active" type="checkbox" tabindex="1">
<label for="control-header-clock-active"><span class="label-icon"></span>Show</label>
</div>
<div class="checkbox-wrap form-input-indent-1">
<input id="control-header-clock-show-seconds" class="control-header-clock-show-seconds" type="checkbox" tabindex="1">
<label for="control-header-clock-show-seconds"><span class="label-icon"></span>Seconds</label>
</div>
<div class="checkbox-wrap form-input-indent-1">
<input id="control-header-clock-show-seperator" class="control-header-clock-show-seperator" type="checkbox" tabindex="1">
<label for="control-header-clock-show-seperator"><span class="label-icon"></span>Seperators</label>
</div>
<div class="checkbox-wrap form-input-indent-1">
<input id="control-header-clock-24" class="control-header-clock-24" type="checkbox" tabindex="1">
<label for="control-header-clock-24"><span class="label-icon"></span>24 Hours</label>
</div>
<div class="checkbox-wrap form-input-indent-2">
<input id="control-header-clock-show-leading-zero" class="control-header-clock-show-leading-zero" type="checkbox" tabindex="1">
<label for="control-header-clock-show-leading-zero"><span class="label-icon"></span>Leading Zero</label>
</div>
<div class="checkbox-wrap form-input-indent-1">
<input id="control-header-clock-show-meridiem" class="control-header-clock-show-meridiem" type="checkbox" tabindex="1">
<label for="control-header-clock-show-meridiem"><span class="label-icon"></span>AM/PM</label>
</div>
</div>
<div class="menu-item">
<h1 class="menu-header">Search</h1>
<div class="checkbox-wrap">
<input id="control-header-search-active" class="control-header-search-active" type="checkbox" tabindex="1">
<label for="control-header-search-active"><span class="label-icon"></span>Show</label>
</div>
<div class="checkbox-wrap form-input-indent-1">
<input id="control-header-search-grow" class="control-header-search-grow" type="checkbox" tabindex="1">
<label for="control-header-search-grow"><span class="label-icon"></span>Fill</label>
</div>
</div>
<div class="menu-item">
<h1 class="menu-header">Engine</h1>
<div class="radio-wrap">
<input id="control-header-search-engine-google" class="control-header-search-engine-google" type="radio" tabindex="1" name="control-header-search-engine" value="google">
<label for="control-header-search-engine-google"><span class="label-icon"></span>Google</label>
</div>
<div class="radio-wrap">
<input id="control-header-search-engine-duckduckgo" class="control-header-search-engine-duckduckgo" type="radio" tabindex="1" name="control-header-search-engine" value="duckduckgo">
<label for="control-header-search-engine-duckduckgo"><span class="label-icon"></span>Duck Duck Go</label>
</div>
<div class="radio-wrap">
<input id="control-header-search-engine-giphy" class="control-header-search-engine-giphy" type="radio" tabindex="1" name="control-header-search-engine" value="giphy">
<label for="control-header-search-engine-giphy"><span class="label-icon"></span>Giphy</label>
</div>
<div class="radio-wrap">
<input id="control-header-search-engine-custom" class="control-header-search-engine-custom" type="radio" tabindex="1" name="control-header-search-engine" value="custom">
<label for="control-header-search-engine-custom"><span class="label-icon"></span>Custom</label>
</div>
<div class="input-wrap">
<label for="control-header-search-engine-custom-url">URL</label>
<input id="control-header-search-engine-custom-url" type="text" class="control-header-search-engine-custom-url mb-0" placeholder="https://" tabindex="1" autocomplete="off">
</div>
</div>
<div class="menu-item">
<h1 class="menu-header">Edit/Add</h1>
<div class="checkbox-wrap">
<input id="control-header-edit-add-active" class="control-header-edit-add-active" type="checkbox" tabindex="1">
<label for="control-header-edit-add-active"><span class="label-icon"></span>Show</label>
</div>
</div>
<div class="menu-item">
<h1 class="menu-header">Accent</h1>
<div class="checkbox-wrap">
<input id="control-header-accent-active" class="control-header-accent-active" type="checkbox" tabindex="1">
<label for="control-header-accent-active"><span class="label-icon"></span>Show</label>
</div>
</div>
<div class="menu-item">
<h1 class="menu-header">Alignment</h1>
<div class="radio-wrap">
<input id="control-layout-alignment-left" class="control-layout-alignment-left" type="radio" tabindex="1" name="control-layout-alignment" value="left">
<label for="control-layout-alignment-left"><span class="label-icon"></span>Left</label>
</div>
<div class="radio-wrap">
<input id="control-layout-alignment-center" class="control-layout-alignment-center" type="radio" tabindex="1" name="control-layout-alignment" value="center">
<label for="control-layout-alignment-center"><span class="label-icon"></span>Center</label>
</div>
<div class="radio-wrap">
<input id="control-layout-alignment-right" class="control-layout-alignment-right" type="radio" tabindex="1" name="control-layout-alignment" value="right">
<label for="control-layout-alignment-right"><span class="label-icon"></span>Right</label>
</div>
</div>
</div>
</div>
<div class="checkbox-wrap form-input-indent-1">
<input id="control-header-clock-show-seconds" class="control-header-clock-show-seconds" type="checkbox" tabindex="1">
<label for="control-header-clock-show-seconds"><span class="label-icon"></span>Seconds</label>
<div class="menu-area menu-area-bookmarks">
<div class="menu-sub-area">
<div class="menu-item">
<h1 class="menu-header">Open</h1>
<div class="checkbox-wrap">
<input id="control-link-new-tab" class="control-link-new-tab" type="checkbox" tabindex="1">
<label for="control-link-new-tab"><span class="label-icon"></span>In a new tab</label>
</div>
</div>
<div class="menu-item">
<h1 class="menu-header">Style</h1>
<div class="radio-wrap">
<input id="control-link-style-block" class="control-link-style-block" type="radio" tabindex="1" name="control-link-style" value="block">
<label for="control-link-style-block"><span class="label-icon"></span>Block</label>
</div>
<div class="radio-wrap">
<input id="control-link-style-list" class="control-link-style-list" type="radio" tabindex="1" name="control-link-style" value="list">
<label for="control-link-style-list"><span class="label-icon"></span>List</label>
</div>
</div>
<div class="menu-item">
<h1 class="menu-header">Sort</h1>
<div class="radio-wrap">
<input id="control-link-sort-none" class="control-link-sort-none" type="radio" tabindex="1" name="control-link-sort" value="none">
<label for="control-link-sort-none"><span class="label-icon"></span>None (As added)</label>
</div>
<div class="radio-wrap">
<input id="control-link-sort-name" class="control-link-sort-name" type="radio" tabindex="1" name="control-link-sort" value="name">
<label for="control-link-sort-name"><span class="label-icon"></span>Name</label>
</div>
<div class="radio-wrap">
<input id="control-link-sort-letter" class="control-link-sort-letter" type="radio" tabindex="1" name="control-link-sort" value="letter">
<label for="control-link-sort-letter"><span class="label-icon"></span>Letter</label>
</div>
</div>
</div>
</div>
<div class="checkbox-wrap form-input-indent-1">
<input id="control-header-clock-show-seperator" class="control-header-clock-show-seperator" type="checkbox" tabindex="1">
<label for="control-header-clock-show-seperator"><span class="label-icon"></span>Seperators</label>
</div>
<div class="checkbox-wrap form-input-indent-1">
<input id="control-header-clock-24" class="control-header-clock-24" type="checkbox" tabindex="1">
<label for="control-header-clock-24"><span class="label-icon"></span>24 Hours</label>
</div>
<div class="checkbox-wrap form-input-indent-2">
<input id="control-header-clock-show-leading-zero" class="control-header-clock-show-leading-zero" type="checkbox" tabindex="1">
<label for="control-header-clock-show-leading-zero"><span class="label-icon"></span>Leading Zero</label>
</div>
<div class="checkbox-wrap form-input-indent-1">
<input id="control-header-clock-show-meridiem" class="control-header-clock-show-meridiem" type="checkbox" tabindex="1">
<label for="control-header-clock-show-meridiem"><span class="label-icon"></span>AM/PM</label>
</div>
<hr>
<h2>Search</h2>
<div class="checkbox-wrap">
<input id="control-header-search-active" class="control-header-search-active" type="checkbox" tabindex="1">
<label for="control-header-search-active"><span class="label-icon"></span>Show</label>
</div>
<div class="checkbox-wrap form-input-indent-1">
<input id="control-header-search-grow" class="control-header-search-grow" type="checkbox" tabindex="1">
<label for="control-header-search-grow"><span class="label-icon"></span>Fill</label>
</div>
<h2>Engine</h2>
<div class="radio-wrap form-input-indent-1">
<input id="control-header-search-engine-google" class="control-header-search-engine-google" type="radio" tabindex="1" name="control-header-search-engine" value="google">
<label for="control-header-search-engine-google"><span class="label-icon"></span>Google</label>
</div>
<div class="radio-wrap form-input-indent-1">
<input id="control-header-search-engine-duckduckgo" class="control-header-search-engine-duckduckgo" type="radio" tabindex="1" name="control-header-search-engine" value="duckduckgo">
<label for="control-header-search-engine-duckduckgo"><span class="label-icon"></span>Duck Duck Go</label>
</div>
<div class="radio-wrap form-input-indent-1">
<input id="control-header-search-engine-giphy" class="control-header-search-engine-giphy" type="radio" tabindex="1" name="control-header-search-engine" value="giphy">
<label for="control-header-search-engine-giphy"><span class="label-icon"></span>Giphy</label>
</div>
<div class="radio-wrap form-input-indent-1">
<input id="control-header-search-engine-custom" class="control-header-search-engine-custom" type="radio" tabindex="1" name="control-header-search-engine" value="custom">
<label for="control-header-search-engine-custom"><span class="label-icon"></span>Custom</label>
</div>
<div class="input-wrap form-input-indent-1">
<label for="control-header-search-engine-custom-url">URL</label>
<input id="control-header-search-engine-custom-url" type="text" class="control-header-search-engine-custom-url mb-0" placeholder="https://" tabindex="1" autocomplete="off">
</div>
<hr>
<h2>Edit/Add</h2>
<div class="checkbox-wrap">
<input id="control-header-edit-add-active" class="control-header-edit-add-active" type="checkbox" tabindex="1">
<label for="control-header-edit-add-active"><span class="label-icon"></span>Show</label>
</div>
<hr>
<h2>Accent</h2>
<div class="checkbox-wrap">
<input id="control-header-accent-active" class="control-header-accent-active" type="checkbox" tabindex="1">
<label for="control-header-accent-active"><span class="label-icon"></span>Show</label>
</div>
<hr>
<h2>Alignment</h2>
<div class="radio-wrap">
<input id="control-layout-alignment-left" class="control-layout-alignment-left" type="radio" tabindex="1" name="control-layout-alignment" value="left">
<label for="control-layout-alignment-left"><span class="label-icon"></span>Left</label>
</div>
<div class="radio-wrap">
<input id="control-layout-alignment-center" class="control-layout-alignment-center" type="radio" tabindex="1" name="control-layout-alignment" value="center">
<label for="control-layout-alignment-center"><span class="label-icon"></span>Center</label>
</div>
<div class="radio-wrap">
<input id="control-layout-alignment-right" class="control-layout-alignment-right" type="radio" tabindex="1" name="control-layout-alignment" value="right">
<label for="control-layout-alignment-right"><span class="label-icon"></span>Right</label>
</div>
</div>
<div class="menu-item">
<h1>Bookmarks</h1>
<div class="checkbox-wrap">
<input id="control-link-new-tab" class="control-link-new-tab" type="checkbox" tabindex="1">
<label for="control-link-new-tab"><span class="label-icon"></span>Open in new tab</label>
</div>
<hr>
<h2>Style</h2>
<div class="radio-wrap">
<input id="control-link-style-block" class="control-link-style-block" type="radio" tabindex="1" name="control-link-style" value="block">
<label for="control-link-style-block"><span class="label-icon"></span>Block</label>
</div>
<div class="radio-wrap">
<input id="control-link-style-list" class="control-link-style-list" type="radio" tabindex="1" name="control-link-style" value="list">
<label for="control-link-style-list"><span class="label-icon"></span>List</label>
</div>
<hr>
<h2>Sort</h2>
<div class="radio-wrap">
<input id="control-link-sort-none" class="control-link-sort-none" type="radio" tabindex="1" name="control-link-sort" value="none">
<label for="control-link-sort-none"><span class="label-icon"></span>None (As added)</label>
</div>
<div class="radio-wrap">
<input id="control-link-sort-name" class="control-link-sort-name" type="radio" tabindex="1" name="control-link-sort" value="name">
<label for="control-link-sort-name"><span class="label-icon"></span>Name</label>
</div>
<div class="radio-wrap">
<input id="control-link-sort-letter" class="control-link-sort-letter" type="radio" tabindex="1" name="control-link-sort" value="letter">
<label for="control-link-sort-letter"><span class="label-icon"></span>Letter</label>
</div>
</div>
<div class="menu-item">
<h1>Layout</h1>
<div class="radio-wrap">
<input id="control-layout-container-fluid" class="control-layout-container-fluid" type="radio" tabindex="1" name="control-layout-container" value="fluid">
<label for="control-layout-container-fluid"><span class="label-icon"></span>Fluid</label>
</div>
<div class="radio-wrap">
<input id="control-layout-container-wide" class="control-layout-container-wide" type="radio" tabindex="1" name="control-layout-container" value="wide">
<label for="control-layout-container-wide"><span class="label-icon"></span>Wide</label>
</div>
<div class="radio-wrap">
<input id="control-layout-container-thin" class="control-layout-container-thin" type="radio" tabindex="1" name="control-layout-container" value="thin">
<label for="control-layout-container-thin"><span class="label-icon"></span>Thin</label>
<div class="menu-area menu-area-layout">
<div class="menu-sub-area">
<div class="menu-item">
<h1 class="menu-header">Width</h1>
<div class="radio-wrap">
<input id="control-layout-container-fluid" class="control-layout-container-fluid" type="radio" tabindex="1" name="control-layout-container" value="fluid">
<label for="control-layout-container-fluid"><span class="label-icon"></span>Fluid</label>
</div>
<div class="radio-wrap">
<input id="control-layout-container-wide" class="control-layout-container-wide" type="radio" tabindex="1" name="control-layout-container" value="wide">
<label for="control-layout-container-wide"><span class="label-icon"></span>Wide</label>
</div>
<div class="radio-wrap">
<input id="control-layout-container-thin" class="control-layout-container-thin" type="radio" tabindex="1" name="control-layout-container" value="thin">
<label for="control-layout-container-thin"><span class="label-icon"></span>Thin</label>
</div>
</div>
</div>
</div>
</div>
</section>

View File

@ -1,5 +1,28 @@
var menu = (function() {
var _bind = function() {
var allMenuNavButton = helper.eA(".menu-nav-button");
allMenuNavButton.forEach(function(arrayItem, index) {
arrayItem.addEventListener("click", function() {
_tab(this);
}, false);
});
};
var _tab = function(button) {
var allMenuNavButton = helper.eA(".menu-nav-button");
var allMenuArea = helper.eA(".menu-area");
var target = helper.e(button.dataset.target);
allMenuNavButton.forEach(function(arrayItem, index) {
helper.removeClass(arrayItem, "active");
});
allMenuArea.forEach(function(arrayItem, index) {
helper.removeClass(arrayItem, "active");
});
helper.addClass(button, "active");
helper.addClass(target, "active");
};
var close = function() {
state.get().menu.active = false;
render();
@ -35,6 +58,7 @@ var menu = (function() {
};
var init = function() {
_bind();
close();
};

View File

@ -58,11 +58,11 @@ var modal = (function() {
modalControls.setAttribute("class", "modal-controls");
var actionButton = document.createElement("button");
actionButton.setAttribute("tabindex", "1");
actionButton.setAttribute("class", "button button-primary button-block button-large");
actionButton.setAttribute("class", "button button-primary button-block");
actionButton.textContent = defaultOptions.actionText;
var cancelButton = document.createElement("button");
cancelButton.setAttribute("tabindex", "1");
cancelButton.setAttribute("class", "button button-primary button-block button-large");
cancelButton.setAttribute("class", "button button-primary button-block");
cancelButton.textContent = defaultOptions.cancelText;
modalControls.appendChild(cancelButton);
modalControls.appendChild(actionButton);