add links list style

This commit is contained in:
isUnknown 2024-09-04 14:48:50 +02:00
parent 100fd301ee
commit 0d60b9289f
4 changed files with 45 additions and 6 deletions

View file

@ -32,6 +32,31 @@
margin-bottom: 1rem;
}
[data-template="sectioned"] main section:nth-child(odd):not(:first-child) {
background-color: var(--color-brown-light);
/* Links list */
[data-template="sectioned"] .links-list li {
position: relative;
display: grid;
grid-template-columns: 3fr 3fr 0.5fr;
border-bottom: 1px solid #000;
margin-bottom: 0.6rem;
padding-bottom: 0.6rem;
font-size: var(--font-size-s);
}
[data-template="sectioned"] .links-list li p {
margin-bottom: 0;
}
[data-template="sectioned"] .links-list li a {
justify-self: end;
}
[data-template="sectioned"] .links-list li a::after {
content: "";
position: absolute;
inset: 0;
}
[data-template="sectioned"] .links-list li a::before {
content: "→";
display: inline-block;
transform: rotate(-45deg);
}

View file

@ -23,6 +23,10 @@ fields:
label: 2ème texte
width: 1/3
link:
type: url
label: Lien
type: link
required: true
options:
- url
- page
width: 1/3

6
site/snippets/a.php Normal file
View file

@ -0,0 +1,6 @@
<?php
$target = str_contains($url, $site->url()) ? '' : ' target="_blank"';
$title = isset($title) ? $title : '';
$text = isset($text) ? $text : '';
?>
<a href="<?= $url ?>"<?= $target ?>><?= $text ?></a>

View file

@ -1,5 +1,9 @@
<ul>
<?php foreach($block->toStructure() as $item): ?>
<li></li>
<ul class="links-list">
<?php foreach($block->items()->toStructure() as $item): ?>
<li>
<p><?= $item->firstText() ?></p>
<p><?= $item->secondText() ?></p>
<?php snippet('a', ['url' => $item->link()->toUrl()]) ?>
</li>
<?php endforeach ?>
</ul>