new nav buttons
This commit is contained in:
parent
7e21e1ffb7
commit
92625d2fb9
11 changed files with 552 additions and 39 deletions
|
|
@ -47,7 +47,7 @@
|
|||
margin-top: calc(var(--unit--vertical-relative) * 19);
|
||||
}
|
||||
|
||||
#home .page-cover {
|
||||
[data-template="home"] .page-cover {
|
||||
padding-top: calc(var(--unit--vertical-relative) * 6);
|
||||
}
|
||||
|
||||
|
|
|
|||
41
assets/css/src/nav.css
Normal file
41
assets/css/src/nav.css
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
#entries {
|
||||
position: sticky;
|
||||
top: calc(var(--unit--vertical) * 8);
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.entry-btn {
|
||||
transition: all 0.5s var(--curve-sine);
|
||||
}
|
||||
|
||||
[data-template="linear"] #entries {
|
||||
transform: translateY(calc(0rem - var(--unit--vertical-relative) * 4));
|
||||
}
|
||||
|
||||
.entry-btn--left::after,
|
||||
.entry-btn--right::before {
|
||||
transition: all 0.5s var(--curve-sine);
|
||||
content: "+";
|
||||
}
|
||||
.entry-btn--left::after {
|
||||
margin-left: var(--unit--horizontal);
|
||||
}
|
||||
.entry-btn--right::before {
|
||||
margin-right: var(--unit--horizontal);
|
||||
}
|
||||
|
||||
#entries.minimized {
|
||||
color: var(--color-secondary);
|
||||
}
|
||||
#entries.minimized .entry-btn::before,
|
||||
#entries.minimized .entry-btn::after {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#entries.minimized .entry-btn--left {
|
||||
margin-left: calc(-4px - var(--width));
|
||||
}
|
||||
#entries.minimized .entry-btn--right {
|
||||
margin-right: calc(-4px - var(--width));
|
||||
}
|
||||
|
|
@ -89,7 +89,7 @@ button.toggle.right.open::before {
|
|||
}
|
||||
|
||||
@media screen and (min-width: 640px) {
|
||||
#home #tabs {
|
||||
[data-template="home"] #tabs {
|
||||
margin-top: calc(0px - (10 * var(--unit--vertical)));
|
||||
}
|
||||
button.toggle.left::after {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
@import url("src/texts.css");
|
||||
@import url("src/header.css");
|
||||
@import url("src/tabs.css");
|
||||
@import url("src/nav.css");
|
||||
@import url("src/home.css");
|
||||
@import url("src/linear.css");
|
||||
@import url("src/footer.css");
|
||||
|
|
|
|||
475
assets/dist/style.css
vendored
475
assets/dist/style.css
vendored
File diff suppressed because one or more lines are too long
|
|
@ -73,25 +73,24 @@ function roundToNearestHalf(num) {
|
|||
return Math.max(round, 0);
|
||||
}
|
||||
|
||||
function enableToggleTabsVisibility() {
|
||||
const tabs = document.querySelector("#tabs");
|
||||
const toggleLeftBtn = tabs.querySelector("button.toggle.left");
|
||||
const toggleRightBtn = tabs.querySelector("button.toggle.right");
|
||||
const toggleLeftBtnWidth = toggleLeftBtn.offsetWidth;
|
||||
const toggleRightBtnWidth = toggleRightBtn.offsetWidth;
|
||||
function enableToggleEntriesVisibility() {
|
||||
const entries = document.querySelector("#entries");
|
||||
|
||||
toggleLeftBtn.style = `--width: ${toggleLeftBtnWidth}px`;
|
||||
toggleRightBtn.style = `--width: ${toggleRightBtnWidth}px`;
|
||||
const leftBtn = entries.querySelector(".entry-btn--left");
|
||||
const rightBtn = entries.querySelector(".entry-btn--right");
|
||||
const leftBtnWidth = leftBtn.offsetWidth;
|
||||
const rightBtnWidth = rightBtn.offsetWidth;
|
||||
|
||||
const toggleVisibility = (entries) => {
|
||||
entries.forEach((entry) => {
|
||||
const isIntersecting = entry.isIntersecting;
|
||||
leftBtn.style = `--width: ${leftBtnWidth}px`;
|
||||
rightBtn.style = `--width: ${rightBtnWidth}px`;
|
||||
|
||||
const toggleVisibility = (items) => {
|
||||
items.forEach((item) => {
|
||||
const isIntersecting = item.isIntersecting;
|
||||
if (isIntersecting) {
|
||||
console.log("is intersecting");
|
||||
tabs.classList.remove("minimized");
|
||||
entries.classList.remove("minimized");
|
||||
} else {
|
||||
console.log("is not intersecting");
|
||||
tabs.classList.add("minimized");
|
||||
entries.classList.add("minimized");
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
@ -104,7 +103,7 @@ function enableToggleTabsVisibility() {
|
|||
threshold: 0,
|
||||
});
|
||||
|
||||
observer.observe(tabs);
|
||||
observer.observe(entries);
|
||||
}
|
||||
|
||||
function toggleLogoState() {
|
||||
|
|
@ -132,6 +131,6 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||
|
||||
// Wait for fonts applied
|
||||
setTimeout(() => {
|
||||
enableToggleTabsVisibility();
|
||||
enableToggleEntriesVisibility();
|
||||
}, 100);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -9,12 +9,12 @@
|
|||
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
|
||||
<meta name="robots" content="noindex, nofollow, noarchive">
|
||||
</head>
|
||||
<body class="grid">
|
||||
<header id="main-header">
|
||||
<div id="logo" >
|
||||
<a href="/" class="no-line">
|
||||
<h1 id="actuel">actuel</h1>
|
||||
<h1 id="inactuel">inactuel</h1>
|
||||
</a>
|
||||
</div>
|
||||
</header>
|
||||
<body class="grid" data-template="<?= $page->template() ?>">
|
||||
<header id="main-header">
|
||||
<div id="logo" >
|
||||
<a href="/" class="no-line">
|
||||
<h1 id="actuel">actuel</h1>
|
||||
<h1 id="inactuel">inactuel</h1>
|
||||
</a>
|
||||
</div>
|
||||
</header>
|
||||
4
site/snippets/nav.php
Normal file
4
site/snippets/nav.php
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<nav id="entries">
|
||||
<button class="entry-btn entry-btn--left">années</button>
|
||||
<button class="entry-btn entry-btn--right">categories</button>
|
||||
</nav>
|
||||
|
|
@ -29,7 +29,7 @@ $activeTab = isset($activeTab) ? Str::slug($activeTab) : '';
|
|||
:class="activeTab === 'texts' ? 'open' : 'close'"
|
||||
title="Voir tous les textes"
|
||||
@click="toggleTab($data, 'texts')"
|
||||
>textes</button>
|
||||
>catégories</button>
|
||||
</div>
|
||||
<div
|
||||
class="active-tab"
|
||||
|
|
@ -70,8 +70,8 @@ $activeTab = isset($activeTab) ? Str::slug($activeTab) : '';
|
|||
<?php snippet(
|
||||
'text-item',
|
||||
[
|
||||
'article' => $article
|
||||
]
|
||||
'article' => $article
|
||||
]
|
||||
) ?>
|
||||
<?php endif ?>
|
||||
<?php endforeach ?>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php snippet('header') ?>
|
||||
|
||||
<main id="<?= $page->template() ?>">
|
||||
<main>
|
||||
<?php snippet('cover', slots: true) ?>
|
||||
<?php slot('title') ?>
|
||||
<h2 class="title-center">
|
||||
|
|
|
|||
|
|
@ -18,12 +18,7 @@
|
|||
</p>
|
||||
<?php endslot() ?>
|
||||
<?php endsnippet() ?>
|
||||
<?php snippet('tabs', [
|
||||
'left' => [
|
||||
'label' => 'édito ' . $page->parent()->title(),
|
||||
'content' => $page->parent()->edito()
|
||||
],
|
||||
]) ?>
|
||||
<?php snippet('nav') ?>
|
||||
<?= $page->body() ?>
|
||||
</article>
|
||||
</main>
|
||||
Loading…
Add table
Add a link
Reference in a new issue