redesign nav panel years
This commit is contained in:
parent
85a6807984
commit
a2722a0264
10 changed files with 112 additions and 68 deletions
|
|
@ -66,6 +66,10 @@
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.light {
|
||||||
|
opacity: var(--opacity-light);
|
||||||
|
}
|
||||||
|
|
||||||
/* ================= COLORS ================= */
|
/* ================= COLORS ================= */
|
||||||
.color {
|
.color {
|
||||||
color: var(--color);
|
color: var(--color);
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
body {
|
body {
|
||||||
position: relative;
|
position: relative;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
padding: 0 var(--unit--horizontal);
|
|
||||||
background-color: var(--color-background);
|
background-color: var(--color-background);
|
||||||
color: var(--color-primary);
|
color: var(--color-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
main {
|
main {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
padding: 0 var(--unit--horizontal);
|
||||||
}
|
}
|
||||||
|
|
||||||
hr {
|
hr {
|
||||||
|
|
|
||||||
|
|
@ -91,3 +91,36 @@
|
||||||
.panel-close::after {
|
.panel-close::after {
|
||||||
content: "◀";
|
content: "◀";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ================= YEARS ================= */
|
||||||
|
.year__toggle {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
margin-bottom: var(--unit--vertical);
|
||||||
|
}
|
||||||
|
|
||||||
|
.year__toggle-icon {
|
||||||
|
color: var(--color-secondary);
|
||||||
|
font-size: var(--font-size-xl);
|
||||||
|
}
|
||||||
|
|
||||||
|
.year__edito {
|
||||||
|
margin-bottom: calc(var(--unit--vertical) / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.year__edito.short {
|
||||||
|
display: -webkit-box;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
-webkit-line-clamp: 5;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.year__texts {
|
||||||
|
margin-top: var(--unit--vertical);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ================= TEXT ITEM ================= */
|
||||||
|
.text {
|
||||||
|
margin-bottom: var(--unit--vertical);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@
|
||||||
--font-weight-bold: 400;
|
--font-weight-bold: 400;
|
||||||
--font-weight-extra-bold: 550;
|
--font-weight-extra-bold: 550;
|
||||||
|
|
||||||
|
--opacity-light: 0.6;
|
||||||
|
|
||||||
--curve-sine: cubic-bezier(0.445, 0.05, 0.55, 0.95);
|
--curve-sine: cubic-bezier(0.445, 0.05, 0.55, 0.95);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,8 @@ const verticalUnit = getUnit("--unit--vertical");
|
||||||
|
|
||||||
function getUnit(id) {
|
function getUnit(id) {
|
||||||
const remFactor = 16;
|
const remFactor = 16;
|
||||||
const rawUnit = getComputedStyle(document.documentElement).getPropertyValue(
|
const rawUnit =
|
||||||
id
|
getComputedStyle(document.documentElement).getPropertyValue(id) || "1.7rem";
|
||||||
);
|
|
||||||
if (rawUnit.length === 0) {
|
|
||||||
throw new Error(`getUnit() error : css variable ${id} doesn't exists.`);
|
|
||||||
}
|
|
||||||
const remUnit = parseFloat(rawUnit);
|
const remUnit = parseFloat(rawUnit);
|
||||||
const pxUnit = remUnit * remFactor;
|
const pxUnit = remUnit * remFactor;
|
||||||
return pxUnit;
|
return pxUnit;
|
||||||
|
|
@ -126,12 +122,9 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||||
top: 0,
|
top: 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
window.addEventListener(
|
window.addEventListener("scroll", () => {
|
||||||
"scroll",
|
|
||||||
throttle(() => {
|
|
||||||
toggleLogoState();
|
toggleLogoState();
|
||||||
}, 10)
|
});
|
||||||
);
|
|
||||||
|
|
||||||
setWindowHeightFactor();
|
setWindowHeightFactor();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<footer id="main-footer">
|
<footer id="main-footer">
|
||||||
<ul id="links" class="| flex full-width" style="
|
<ul id="links" class="| flex full-width" style="
|
||||||
--content: center;
|
--content: center;
|
||||||
--gap: 1;
|
--gap: 1;
|
||||||
|
|
@ -12,6 +12,6 @@
|
||||||
<a href="#">s'abonner</a>
|
<a href="#">s'abonner</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</footer>
|
</footer>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
@ -12,40 +12,52 @@
|
||||||
|
|
||||||
<nav class="panel panel--left">
|
<nav class="panel panel--left">
|
||||||
<ul
|
<ul
|
||||||
x-show="activeTab === 'texts'">
|
class="years"
|
||||||
|
>
|
||||||
<?php foreach($kirby->collection('years') as $year): ?>
|
<?php foreach($kirby->collection('years') as $year): ?>
|
||||||
<div
|
<li
|
||||||
x-data='{
|
class="year"
|
||||||
isOpen: false
|
x-data='{ year: false }'
|
||||||
}'
|
>
|
||||||
:class="isOpen ? '' : 'short'"
|
<button
|
||||||
class="
|
class="year__toggle"
|
||||||
texts__year
|
:class="year ? '' : 'short'"
|
||||||
| full-width
|
@click="year = !year"
|
||||||
flex column
|
|
||||||
bottom"
|
|
||||||
style="
|
|
||||||
--content: center;
|
|
||||||
--bottom: 2;"
|
|
||||||
>
|
>
|
||||||
<h3 class="fs-xl color" style="--color:var(--color-secondary)"><?= $year->title() ?></h3>
|
<h3 class="fs-xl color" style="--color:var(--color-secondary)"><?= $year->title() ?></h3>
|
||||||
<div class="year__edito">
|
<div
|
||||||
|
class="year__toggle-icon"
|
||||||
|
x-text="year ? '-' : '+'"
|
||||||
|
></div>
|
||||||
|
</button>
|
||||||
|
<div
|
||||||
|
class="year__content"
|
||||||
|
x-show="year"
|
||||||
|
x-data="{edito: false}"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="year__edito"
|
||||||
|
:class="edito ? '' : 'short'"
|
||||||
|
>
|
||||||
<?= $year->edito() ?>
|
<?= $year->edito() ?>
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
:class="isOpen ? 'open' : 'close'"
|
:class="edito ? 'open' : 'close'"
|
||||||
class="see-more toggle left" @click="isOpen = !isOpen">Lire</button>
|
class="see-more toggle left" @click="edito = !edito"
|
||||||
</div>
|
>Lire</button>
|
||||||
|
<ul class="year__texts">
|
||||||
<?php foreach($year->children() as $article): ?>
|
<?php foreach($year->children() as $article): ?>
|
||||||
<?php snippet(
|
<?php snippet(
|
||||||
'text-item',
|
'text-item',
|
||||||
array(
|
array('article' => $article)
|
||||||
'article' => $article
|
|
||||||
)
|
|
||||||
) ?>
|
) ?>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
onclick="togglePanel('left')"
|
onclick="togglePanel('left')"
|
||||||
class="panel-close">
|
class="panel-close">
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
<li class="texts | bottom" style="--bottom:3">
|
<li class="text">
|
||||||
<a href="<?= $article->url() ?>" class="texts__title no-line">
|
<a href="<?= $article->url() ?>" class="texts__title no-line">
|
||||||
<h3><?= $article->title() ?></h3>
|
<h3><?= $article->title() ?></h3>
|
||||||
</a>
|
</a>
|
||||||
<div class="texts__infos">
|
<div class="text__infos">
|
||||||
<p>
|
<p>
|
||||||
<span class="opacity" style="--opacity:.5">par</span>
|
<span class="opacity-light">par</span>
|
||||||
<a class="author" href="/auteurs/<?= Str::slug($article->author()->toUser()->name()) ?>"><?= $article->author()->toUser()->name() ?></a><br>
|
<a class="author" href="/auteurs/<?= Str::slug($article->author()->toUser()->name()) ?>"><?= $article->author()->toUser()->name() ?></a><br>
|
||||||
<span class="opacity" style="--opacity:.6">publié le </span><?= $article->published()->toDate('d/m/Y') ?>
|
<span class="opacity-light">publié le </span><?= $article->published()->toDate('d/m/Y') ?>
|
||||||
<span class="opacity" style="--opacity: .6">dans</span> <a href="/categories/<?= $article->category() ?>"><?= $article->category() ?></a>
|
<span class="opacity-light">dans</span> <a href="/categories/<?= $article->category() ?>"><?= $article->category() ?></a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<?php snippet('cover', slots: true) ?>
|
<?php snippet('cover', slots: true) ?>
|
||||||
<?php slot('title') ?>
|
<?php slot('title') ?>
|
||||||
<h1 class="main-title <?= setTitleFontSizeClass($page->title()) ?>"><?= $page->title() ?></h1>
|
<h1 class="main-title <?= setTitleFontSizeClass($page->title()) ?>"><?= $page->title() ?></h1>
|
||||||
<p class="opacity" style="--opacity:.6">catégorie</p>
|
<p class="opacity-light">catégorie</p>
|
||||||
<?php endslot() ?>
|
<?php endslot() ?>
|
||||||
<?php endsnippet() ?>
|
<?php endsnippet() ?>
|
||||||
<div
|
<div
|
||||||
|
|
@ -45,7 +45,7 @@
|
||||||
<ul>
|
<ul>
|
||||||
<?php foreach($year->children() as $article): ?>
|
<?php foreach($year->children() as $article): ?>
|
||||||
<?php if ($article->category() == $page->title()->value()) : ?>
|
<?php if ($article->category() == $page->title()->value()) : ?>
|
||||||
<?php snippet('text-item', ['article' => $article]) ?>
|
<?php snippet('text-item', array('article' => $article)) ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
<?php snippet('header') ?>
|
<?php snippet('header') ?>
|
||||||
<main id="<?= $page->template() ?>">
|
<main id="<?= $page->template() ?>">
|
||||||
<article>
|
<article>
|
||||||
<?php snippet('cover', ['isOpen' => true], slots: true) ?>
|
<?php snippet('cover', array('isOpen' => true), slots: true) ?>
|
||||||
<?php slot('title') ?>
|
<?php slot('title') ?>
|
||||||
<h2 class="main-title <?= setTitleFontSizeClass($page->title()) ?>"><?= $page->title() ?></h2>
|
<h2 class="main-title <?= setTitleFontSizeClass($page->title()) ?>"><?= $page->title() ?></h2>
|
||||||
<p>
|
<p>
|
||||||
<span class="opacity" style="--opacity:.6">par </span>
|
<span class="opacity-light">par </span>
|
||||||
<a
|
<a
|
||||||
class="author"
|
class="author"
|
||||||
href="/auteurs/<?= Str::slug($page->author()->toUser()->name()) ?>"
|
href="/auteurs/<?= Str::slug($page->author()->toUser()->name()) ?>"
|
||||||
|
|
@ -13,8 +13,8 @@
|
||||||
>
|
>
|
||||||
<?= $page->author()->toUser()->name() ?>
|
<?= $page->author()->toUser()->name() ?>
|
||||||
</a><br>
|
</a><br>
|
||||||
<span class="opacity" style="--opacity:.6">publié le </span><?= $page->published()->toDate('d/m/Y') ?>
|
<span class="opacity-light">publié le </span><?= $page->published()->toDate('d/m/Y') ?>
|
||||||
<span class="opacity" style="--opacity: .6">dans</span> <a href="/categories/<?= $page->category() ?>"><?= $page->category() ?></a>
|
<span class="opacity-light">dans</span> <a href="/categories/<?= $page->category() ?>"><?= $page->category() ?></a>
|
||||||
</p>
|
</p>
|
||||||
<?php endslot() ?>
|
<?php endslot() ?>
|
||||||
<?php endsnippet() ?>
|
<?php endsnippet() ?>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue