Skip to content

Commit

Permalink
Merge pull request #7 from hans2103/metismenu-frontend
Browse files Browse the repository at this point in the history
Metismenu frontend
  • Loading branch information
drmenzelit authored Aug 10, 2020
2 parents 9c229e5 + c9fefdf commit f271621
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 79 deletions.
2 changes: 1 addition & 1 deletion templates/cassiopeia/html/mod_menu/metismenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

$ulAttribs = [
'id' => $params->get('tag_id', ''),
'class' => 'mod-menu metismenu ' . $class_sfx . ' mod-list'
'class' => 'mod-menu mod-menu_metismenu metismenu' . $class_sfx . ' mod-list'
];

// The menu class is deprecated. Use mod-menu instead
Expand Down
14 changes: 6 additions & 8 deletions templates/cassiopeia/js/mm-horizontal.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
document.addEventListener("DOMContentLoaded", function(event) {
const mm1 = new MetisMenu("#menu").on("shown.metisMenu", function(event) {
window.addEventListener("click", function mmClick1(e) {
if (!event.target.contains(e.target)) {
mm1.hide(event.detail.shownElement);
window.removeEventListener("click", mmClick1);
}
});
});
const allMenus = document.querySelectorAll('ul.mod-menu_metismenu');

allMenus.forEach(menu => {
// eslint-disable-next-line no-new, no-undef
new MetisMenu(menu);
});
});
3 changes: 3 additions & 0 deletions templates/cassiopeia/scss/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,6 @@ $zindex-tooltip: 1070;
$zindex-mobile-bottom: 8000;
$zindex-mobile-toggle: 9999;
$zindex-mobile-menu: 9000;

// MetisMenu
$metismenu: true !default;
70 changes: 0 additions & 70 deletions templates/cassiopeia/scss/blocks/_metismenu.scss

This file was deleted.

1 change: 1 addition & 0 deletions templates/cassiopeia/scss/template.scss
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
@import "vendor/bootstrap/table";
@import "vendor/chosen";
@import "vendor/dragula";
@import "vendor/metismenu/metismenu";
@import "vendor/minicolors";
@import "vendor/tinymce";

Expand Down
72 changes: 72 additions & 0 deletions templates/cassiopeia/scss/vendor/metismenu/_metismenu.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
@if $metismenu == true {
.metismenu {
display: flex;
flex-direction: column;

@media (min-width: 992px) {
flex-direction: row;
}

> li {
flex: 1 1 0%;
display: flex;
flex-direction: column;
position: relative;

@media (min-width: 992px) {
flex-direction: column;

> ul {
position: absolute;
top: 100%;
min-width: 100%;
z-index: 1001;
background-color: #f8f9fa;
color: #333333;
}
}
}

a {
position: relative;
display: block;
padding: 15px;
color: #adb5bd;
outline-width: 0;
transition: all .3s ease-out;

&:hover,
&:focus,
&:active {
color: #f8f9fa;
text-decoration: none;
background: #0b7285;
}
}

.mm-collapse:not(.mm-show) {
display: none;
}

.has-arrow::after {
position: absolute;
content: "";
width: 0.5em;
height: 0.5em;
border-width: 1px 0 0 1px;
border-style: solid;
border-color: currentColor;
border-color: initial;
right: 1em;
transform: rotate(-45deg) translate(0, -50%);
transform-origin: top;
top: 50%;
transition: all 0.3s ease-out;
}

.mm-active > .has-arrow::after,
.has-arrow[aria-expanded="true"]::after {
transform: rotate(-135deg) translate(0, -50%);
}
}
}

0 comments on commit f271621

Please sign in to comment.