update small-menu

This commit is contained in:
Simon Vieille 2022-04-20 23:39:12 +02:00
parent f4c9da497f
commit 2024e5ace4
Signed by: deblan
GPG Key ID: 579388D585F70417
6 changed files with 96 additions and 30 deletions

0
.build Normal file
View File

View File

@ -36,6 +36,7 @@ font:
deploy-prod:
mage deploy prod
ssh webdeblanio@deblan.fr "cd blog && test -f .build && make build || true"
deploy-preprod:
mage deploy preprod

View File

@ -173,14 +173,16 @@ pre[class*="language-"] {
position: fixed;
bottom: 0;
width: 100%;
z-index: 1000;
z-index: 2000;
.navigation {
padding-top: 0;
float: right;
display: none;
a {
margin-left: 2px;
padding-top: 12px;
padding-bottom: 12px;
}
.deblan-icon {
@ -188,6 +190,10 @@ pre[class*="language-"] {
}
}
&.is-open .navigation {
display: block;
}
img {
padding: 10px;
}
@ -843,6 +849,56 @@ $links: (
}
}
.menu-opener {
background-color: transparent;
border: none;
cursor: pointer;
display: flex;
padding: 0;
width: 50px;
float: right;
.line {
fill: none;
stroke: $color-white;
stroke-width: 6;
transition: stroke-dasharray 600ms cubic-bezier(0.4, 0, 0.2, 1), stroke-dashoffset 600ms cubic-bezier(0.4, 0, 0.2, 1);
}
.line1 {
stroke-dasharray: 60 207;
stroke-width: 6;
}
.line2 {
stroke-dasharray: 60 60;
stroke-width: 6;
}
.line3 {
stroke-dasharray: 60 207;
stroke-width: 6;
}
&.is-open .line1 {
stroke-dasharray: 90 207;
stroke-dashoffset: -134;
stroke-width: 6;
}
&.is-open .line2 {
stroke-dasharray: 1 60;
stroke-dashoffset: -30;
stroke-width: 6;
}
&.is-open .line3 {
stroke-dasharray: 90 207;
stroke-dashoffset: -134;
stroke-width: 6;
}
}
@media screen and (max-width: 1280px) {
.mesh-wrapper {
width: 100%;
@ -886,30 +942,6 @@ $links: (
}
}
@media screen and (max-width: 500px) {
.small-menu {
> a {
display: none;
}
}
}
@media screen and (max-width: 450px) {
.navigation {
a {
padding: 10px 13px;
}
}
}
@media screen and (max-width: 400px) {
.navigation {
a {
padding: 7px 10px;
}
}
}
@media screen and (max-width: 719px) {
.content {
width: 100%;

View File

@ -11,6 +11,7 @@ const VideoRatio = require('./app/video-ratio')
const Stats = require('./app/stats')
const Particles = require('./app/particles')
const MeshViewer = require('./app/mesh-viewer')
const SmallMenu = require('./app/small-menu')
const app = new App([
new FormPnw(window),
@ -22,7 +23,8 @@ const app = new App([
new VideoRatio(window),
// new Stats(),
new Particles(window),
new MeshViewer(window)
new MeshViewer(window),
new SmallMenu(window),
])
window.addEventListener('load', function () {

View File

@ -0,0 +1,22 @@
const Routing = require('./routing')
const SmallMenu = function (w) {
this.window = w
}
SmallMenu.prototype.addEvent = function () {
const document = this.window.document
const menu = document.querySelector('.small-menu')
const opener = document.querySelector('.menu-opener')
opener.addEventListener('click', () => {
menu.classList.toggle('is-open')
opener.classList.toggle('is-open')
})
}
SmallMenu.prototype.init = function () {
this.addEvent()
}
module.exports = SmallMenu

View File

@ -63,9 +63,9 @@
<img src="{{ asset('build/images/logo-small.png') }}" class="fixed" alt="Deblan blog">
</a>
<nav class="navigation push-right">
<nav class="navigation">
{% if menu %}
<ul class="list--inline">
<ul>
{%- for item in menu.rootNode.children -%}
<li>
<a href="{{ safe_node_url(item, {_domain: _domain}) }}">
@ -81,11 +81,20 @@
{{- icon|raw -}}
<span class="d-none">{{ item.label }}</span>
{{ item.label }}
</a>
</li>
{%- endfor -%}
</ul>
{% endif %}
</nav>
<button class="menu-opener" aria-label="Menu">
<svg width="50" height="46" viewBox="0 0 100 100">
<path class="line line1" d="M 20,29.000046 H 80.000231 C 80.000231,29.000046 94.498839,28.817352 94.532987,66.711331 94.543142,77.980673 90.966081,81.670246 85.259173,81.668997 79.552261,81.667751 75.000211,74.999942 75.000211,74.999942 L 25.000021,25.000058" />
<path class="line line2" d="M 20,50 H 80" />
<path class="line line3" d="M 20,70.999954 H 80.000231 C 80.000231,70.999954 94.498839,71.182648 94.532987,33.288669 94.543142,22.019327 90.966081,18.329754 85.259173,18.331003 79.552261,18.332249 75.000211,25.000058 75.000211,25.000058 L 25.000021,74.999942" />
</svg>
</button>
</div>