diff --git a/assets/js/app.js b/assets/js/app.js index 2c4466c..10fa287 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -2,6 +2,7 @@ import './external_links'; import './message_icons'; import './forms'; import './copyable_text'; +import './main_menu'; import '../sass/app.scss'; diff --git a/assets/js/main_menu.js b/assets/js/main_menu.js new file mode 100644 index 0000000..f2a89da --- /dev/null +++ b/assets/js/main_menu.js @@ -0,0 +1,17 @@ +document.addEventListener('DOMContentLoaded', () => { + const menuButton = document.getElementById('menu-button'); + const mainMenu = document.getElementById('main-menu'); + + menuButton.addEventListener('click', (e) => { + e.stopPropagation(); + mainMenu.classList.toggle('open'); + }); + + mainMenu.addEventListener('click', (e) => { + e.stopPropagation(); + }); + + document.addEventListener('click', () => { + mainMenu.classList.remove('open'); + }); +}); \ No newline at end of file diff --git a/assets/sass/_vars.scss b/assets/sass/_vars.scss index cae690a..21d06e7 100644 --- a/assets/sass/_vars.scss +++ b/assets/sass/_vars.scss @@ -25,3 +25,6 @@ $warningColor: desaturate($warningText, 50%); $error: #ff0000; $errorText: darken($error, 30%); $errorColor: desaturate($errorText, 50%); + +// Responsivity +$menuLayoutSwitchTreshold: 700px; diff --git a/assets/sass/layout.scss b/assets/sass/layout.scss index 9cc7bfd..2185a98 100644 --- a/assets/sass/layout.scss +++ b/assets/sass/layout.scss @@ -51,32 +51,83 @@ header { } } - nav ul { - display: flex; - flex-direction: row; - margin: 0; - padding: 0; + nav { + ul { + display: flex; + flex-direction: row; + margin: 0; + padding: 0; - font-size: 20px; + font-size: 20px; - li { - list-style: none; + li { + list-style: none; - a, span { - display: flex; - flex-direction: row; - align-items: center; - height: 64px; - padding: 0 24px; + a, span { + display: flex; + flex-direction: row; + align-items: center; + height: 64px; + padding: 0 24px; + + .feather { + --icon-size: 24px; + margin-right: 10px; + } + } + + a:hover, a:active { + background-color: rgba(255, 255, 255, 0.07); + } + } + } + + #menu-button { + display: none; + } + } + + @media (max-width: $menuLayoutSwitchTreshold) { + flex-direction: row-reverse; + + .logo { + padding: 0 16px 0 8px; + font-size: 24px; + + img { + margin-right: 8px; + } + } + + nav { + #menu-button { + display: block; + margin: 0; + padding: 0 16px; + line-height: $headerHeight; + + cursor: pointer; + background: transparent; + border-radius: 0; .feather { - --icon-size: 24px; - margin-right: 10px; + --icon-size: 28px; + margin: 0 8px; } } - a:hover { - background-color: rgba(255, 255, 255, 0.07); + ul { + flex-direction: column; + position: absolute; + left: 0; + transform: translateX(-100%); + transition: transform ease-out 150ms; + + background-color: $headerBackground; + + &.open { + transform: translateX(0%); + } } } } diff --git a/config/default.ts b/config/default.ts index 2d97df0..8f2cf14 100644 --- a/config/default.ts +++ b/config/default.ts @@ -14,13 +14,13 @@ export default Object.assign(require("wms-core/config/default").default, { host: "localhost", user: "root", password: "", - database: "wms2", + database: "example_app", create_database_automatically: false }, redis: { host: "127.0.0.1", port: 6379, - prefix: 'wms' + prefix: 'example_app' }, session: { secret: "very_secret_not_known", diff --git a/package.json b/package.json index aec7d2a..f9bf4df 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "@babel/preset-env": "^7.9.5", "@types/config": "^0.0.36", "@types/express": "^4.17.6", + "@types/formidable": "^1.0.31", "@types/jest": "^25.2.1", "@types/node": "^13.13.2", "babel-loader": "^8.1.0", diff --git a/views/layouts/barebone.njk b/views/layouts/barebone.njk index c40f522..3a82d94 100644 --- a/views/layouts/barebone.njk +++ b/views/layouts/barebone.njk @@ -8,6 +8,8 @@ + + {% if description %} {% endif %} diff --git a/views/layouts/base.njk b/views/layouts/base.njk index 97f72d7..f87c6aa 100644 --- a/views/layouts/base.njk +++ b/views/layouts/base.njk @@ -14,7 +14,8 @@ {% block header %}