style gallery

This commit is contained in:
Julie Blanc 2025-12-19 19:35:22 +01:00
parent 57037fc435
commit 14438b642b
12 changed files with 388 additions and 333 deletions

View file

@ -40,5 +40,6 @@ body{
main{
padding-top: var(--header-h);
// padding-bottom: 10vh;
min-height: calc(100vh - var(--spacing)*2);
min-height: calc(100dvh - var(--spacing)*2);
}

View file

@ -33,6 +33,7 @@
--color-bg: #161616;
--color-txt: #ffffff;
--color-txt-light: #b9b9b9;
--color-accent: #00ff00;
--color-accent-50: #e9ffe9;
--color-accent-100: #d8fdd8;

View file

@ -1,14 +1,13 @@
#site-footer {
background-color: black;
width: 100vw;
position: relative;
left: calc(var(--padding-body)*-1);
padding: calc(var(--padding-body) * 2) var(--padding-body);
// border-top: var(--border-light);
height: calc(var(--spacing)*2);
display: flex;
align-items: center;
justify-content: center;
p {
margin: calc(var(--spacing) * 0.5) 0;
a {
text-decoration: none;
@ -16,97 +15,11 @@
text-decoration: underline;
}
}
}
.p__small {
font-size: var(--fs-x-small);
// margin-top: calc(var(--spacing)*0.5)
}
#list-socials {
list-style: none;
columns: 2;
max-width: 500px;
margin: 0;
a {
display: flex;
align-items: center;
gap: 1ch;
text-decoration: none;
height: calc(var(--spacing) * 1);
&::after {
content: "";
color: var(--grey-300);
}
}
.text {
line-height: 1;
}
.icon {
width: 20px;
height: 20px;
position: relative;
top: -2px;
}
svg {
display: flex;
align-items: center;
width: 20px;
height: 20px;
}
}
@media #{$small} {
margin-top: calc(var(--spacing) * 2);
.footer__socials {
margin-top: calc(var(--spacing) * 1.5);
}
.footer__mentions {
margin-top: calc(var(--spacing) * 0.5);
p {
// font-size: var(--font-size);
margin-top: calc(var(--spacing) * 2);
}
}
}
@media #{$small-up} {
.site-footer__container {
display: grid;
grid-template-columns: 1fr 1fr;
column-gap: calc(var(--spacing) * 2);
max-width: 1200px;
margin: 0 auto;
}
.footer__mentions {
grid-column: span 2;
text-align: center;
p {
font-size: var(--font-size);
margin-top: calc(var(--spacing) * 2);
}
}
}
@media #{$medium-up} {
.site-footer__container {
column-gap: calc(var(--spacing) * 4);
}
}
@media #{$small} {
.footer__mentions {
padding-top: calc(var(--spacing) * 1);
p {
margin-top: 0;
}
text-align: center;
}
}
}

View file

@ -16,6 +16,7 @@
--fw-bold: 600;
--color-bg: #161616;
--color-txt: #ffffff;
--color-txt-light: #b9b9b9;
--color-accent: #00ff00;
--color-accent-50: #e9ffe9;
--color-accent-100: #d8fdd8;
@ -79,6 +80,8 @@ body {
main {
padding-top: var(--header-h);
min-height: calc(100vh - var(--spacing) * 2);
min-height: calc(100dvh - var(--spacing) * 2);
}
.nav--tabs {
@ -556,100 +559,21 @@ main {
width: 100vw;
position: relative;
left: calc(var(--padding-body) * -1);
padding: calc(var(--padding-body) * 2) var(--padding-body);
height: calc(var(--spacing) * 2);
display: flex;
align-items: center;
justify-content: center;
}
#site-footer p {
margin: calc(var(--spacing) * 0.5) 0;
}
#site-footer p a {
#site-footer a {
text-decoration: none;
}
#site-footer p a:hover {
#site-footer a:hover {
text-decoration: underline;
}
#site-footer .p__small {
font-size: var(--fs-x-small);
}
#site-footer #list-socials {
list-style: none;
-moz-columns: 2;
columns: 2;
max-width: 500px;
margin: 0;
}
#site-footer #list-socials a {
display: flex;
align-items: center;
gap: 1ch;
text-decoration: none;
height: calc(var(--spacing) * 1);
}
#site-footer #list-socials a::after {
content: "↗";
color: var(--grey-300);
}
#site-footer #list-socials .text {
line-height: 1;
}
#site-footer #list-socials .icon {
width: 20px;
height: 20px;
position: relative;
top: -2px;
}
#site-footer #list-socials svg {
display: flex;
align-items: center;
width: 20px;
height: 20px;
}
@media screen and (max-width: 720px) {
#site-footer {
margin-top: calc(var(--spacing) * 2);
}
#site-footer .footer__socials {
margin-top: calc(var(--spacing) * 1.5);
}
#site-footer .footer__mentions {
margin-top: calc(var(--spacing) * 0.5);
}
#site-footer .footer__mentions p {
margin-top: calc(var(--spacing) * 2);
}
}
@media screen and (min-width: 720px) {
#site-footer .site-footer__container {
display: grid;
grid-template-columns: 1fr 1fr;
-moz-column-gap: calc(var(--spacing) * 2);
column-gap: calc(var(--spacing) * 2);
max-width: 1200px;
margin: 0 auto;
}
#site-footer .footer__mentions {
grid-column: span 2;
text-align: center;
}
#site-footer .footer__mentions p {
font-size: var(--font-size);
margin-top: calc(var(--spacing) * 2);
}
}
@media screen and (min-width: 1080px) {
#site-footer .site-footer__container {
-moz-column-gap: calc(var(--spacing) * 4);
column-gap: calc(var(--spacing) * 4);
}
}
@media screen and (max-width: 720px) {
#site-footer .footer__mentions {
padding-top: calc(var(--spacing) * 1);
text-align: center;
}
#site-footer .footer__mentions p {
margin-top: 0;
}
}
[data-template=support] section {
display: flex;
@ -1016,9 +940,6 @@ body.is-fullscreen {
overflow: hidden;
}
[data-template=store] main {
margin-bottom: calc(var(--spacing) * 2);
}
[data-template=store] .p__baseline-big {
margin-top: calc(var(--spacing) * 2);
}
@ -1093,13 +1014,23 @@ body.is-fullscreen {
.section__product,
.store__nav {
max-width: 1000px;
max-width: 1200px;
margin-left: auto;
margin-right: auto;
}
.section__product,
.store__nav {
max-width: 1200px;
margin-left: auto;
margin-right: auto;
}
.store__nav {
padding-top: calc(var(--spacing) * 1);
padding-bottom: calc(var(--spacing) * 0.5);
color: var(--color-txt-light);
font-size: var(--fs-small);
}
.store__nav a {
text-decoration: none;
@ -1111,32 +1042,27 @@ body.is-fullscreen {
content: "← ";
}
.section__product .product-gallery li {
list-style: none;
.section__product .details ul {
margin-left: 2ch;
}
.section__product .product-gallery figure {
aspect-ratio: 1/1;
.section__product .details ul li {
padding-bottom: 0.2em;
}
.section__product .product-gallery figure img {
width: 100%;
height: 100%;
-o-object-fit: contain;
object-fit: contain;
}
.section__product .product-options__list {
.product-options__list {
list-style: none;
display: flex;
gap: 2ch;
}
.section__product .product-options__list li {
.product-options__list li {
position: relative;
}
.section__product .product-options__list li input[type=radio] {
.product-options__list li input[type=radio] {
position: fixed;
opacity: 0;
pointer-events: none;
}
.section__product .product-options__list li label {
.product-options__list li label {
font-family: var(--title);
font-size: var(--fs-normal);
height: 4ch;
@ -1150,31 +1076,87 @@ body.is-fullscreen {
padding-top: 0px;
cursor: pointer;
}
.section__product .product-options__list li input[type=radio]:checked + label {
.product-options__list li input[type=radio]:checked + label {
border-color: var(--color-txt);
}
.section__product .product-options__list li input[type=radio]:not(:checked) + label:hover {
.product-options__list li input[type=radio]:not(:checked) + label:hover {
border-color: var(--grey-600);
background-color: var(--grey-800);
}
.section__product .hero {
margin-bottom: calc(var(--spacing) * 1);
padding-top: calc(var(--spacing) * 0.5);
border-top: var(--border-light);
.product-gallery {
position: relative;
aspect-ratio: 4/3;
}
.section__product .hero .p__baseline-big {
.product-gallery .swiper-slide {
width: 100%;
}
.product-gallery .swiper-slide figure {
aspect-ratio: 4/3;
width: 100%;
height: 100%;
}
.product-gallery .swiper-slide figure img {
width: 100%;
height: 100%;
-o-object-fit: contain;
object-fit: contain;
}
.product-gallery .swiper-button-prev,
.product-gallery .swiper-button-next {
color: var(--color-txt);
width: 20px;
height: 20px;
}
.product-gallery .swiper-button-prev:after,
.product-gallery .swiper-button-next:after {
font-size: 20px;
font-weight: bold;
}
.product-gallery .swiper-button-prev:hover,
.product-gallery .swiper-button-next:hover {
opacity: 0.7;
}
.product-gallery .swiper-pagination {
position: relative;
margin-top: calc(var(--spacing) * 0.5);
bottom: 0;
}
.product-gallery .swiper-pagination .swiper-pagination-bullet {
width: 8px;
height: 8px;
background: var(--grey-600);
opacity: 0.5;
transition: opacity 0.3s;
}
.product-gallery .swiper-pagination .swiper-pagination-bullet:hover {
opacity: 0.7;
}
.product-gallery .swiper-pagination .swiper-pagination-bullet-active {
background: var(--color-txt);
opacity: 1;
}
.hero {
margin-bottom: calc(var(--spacing) * 1);
padding: calc(var(--spacing) * 0.5) 0;
border-top: var(--border-light);
border-bottom: var(--border-light);
}
.hero .p__baseline-big {
margin: 0;
text-align: left;
}
.section__product .add-to-cart,
.section__product .product-options {
.add-to-cart {
margin: 0;
border-bottom: var(--border-light);
padding: calc(var(--spacing) * 0.5) 0;
}
.section__product .product-options__label {
font-weight: 600;
margin-bottom: calc(var(--spacing) * 0.25);
.product-options {
border-bottom: var(--border-light);
padding: calc(var(--spacing) * 0.25) 0;
}
@media screen and (max-width: 720px) {
@ -1185,6 +1167,7 @@ body.is-fullscreen {
.section__product {
display: flex;
flex-direction: column;
margin-bottom: 10vh;
}
.section__product .col-left {
display: contents;
@ -1208,34 +1191,39 @@ body.is-fullscreen {
.section__product .add-to-cart {
order: 5;
}
.section__product .product-gallery {
width: 100vw;
position: relative;
left: calc(var(--padding-body) * -1);
}
.section__product .product-gallery .swiper-button-prev,
.section__product .product-gallery .swiper-button-next {
display: none;
}
}
@media screen and (min-width: 720px) {
.section__product {
display: grid;
grid-template-columns: 50% 50%;
aspect-ratio: 2/1;
margin-top: calc(var(--spacing) * 0.5);
position: relative;
}
.section__product .col-left {
padding-right: var(--padding-body);
}
.section__product .details {
grid-template-columns: 1fr 1fr;
gap: calc(var(--padding-body) * 2);
margin-bottom: calc(var(--spacing) * 3);
}
.section__product .add-to-cart,
.section__product .product-options {
width: calc(50% - var(--padding-body));
}
.section__product .add-to-cart {
position: absolute;
bottom: 10px;
.section__product .details {
margin-bottom: calc(var(--spacing) * 2);
flex-grow: 1;
}
.section__product .product-options {
position: absolute;
bottom: calc(var(--spacing) * 2);
border-top: var(--border-light);
}
.section__product .col-left {
min-height: 100%;
padding-bottom: 40px;
display: flex;
flex-direction: column;
}
.product-gallery .swiper-slide figure {
width: calc(100% - 60px);
}
}
[data-template=thanks] .thanks-page {
min-height: 60vh;

File diff suppressed because one or more lines are too long

View file

@ -1,7 +1,5 @@
[data-template="store"] {
main {
margin-bottom: calc(var(--spacing) * 2);
}
.p__baseline-big {
margin-top: calc(var(--spacing) * 2);

View file

@ -1,12 +1,28 @@
.section__product,
.store__nav{
max-width: 1000px;
max-width: 1200px;
margin-left: auto;
margin-right: auto;
}
.section__product,
.store__nav {
max-width: 1200px;
margin-left: auto;
margin-right: auto;
}
.store__nav {
padding-top: calc(var(--spacing) * 1);
padding-bottom: calc(var(--spacing) * 0.5);
color: var(--color-txt-light);
font-size: var(--fs-small);
a {
text-decoration: none;
@ -21,22 +37,20 @@
}
}
.section__product {
.product-gallery {
li {
list-style: none;
}
figure {
aspect-ratio: 1/1;
img {
width: 100%;
height: 100%;
object-fit: contain;
.section__product .details {
// margin-bottom: calc(var(--spacing) * 2);
ul{
margin-left: 2ch;
li{
padding-bottom: 0.2em;
}
}
}
.product-options__list {
list-style: none;
display: flex;
@ -77,10 +91,83 @@
}
}
.product-gallery {
position: relative;
aspect-ratio: 4 / 3;
.swiper-slide {
width: 100%;
figure {
aspect-ratio: 4 / 3;
width: 100%;
height: 100%;
img {
width: 100%;
height: 100%;
object-fit: contain;
}
}
}
// Swiper navigation arrows
.swiper-button-prev,
.swiper-button-next {
color: var(--color-txt);
width: 20px;
height: 20px;
&:after {
font-size: 20px;
font-weight: bold;
}
&:hover {
opacity: 0.7;
}
}
// Swiper pagination dots
.swiper-pagination {
position: relative;
margin-top: calc(var(--spacing) * 0.5);
bottom: 0;
.swiper-pagination-bullet {
width: 8px;
height: 8px;
background: var(--grey-600);
opacity: 0.5;
transition: opacity 0.3s;
&:hover {
opacity: 0.7;
}
}
.swiper-pagination-bullet-active {
background: var(--color-txt);
opacity: 1;
}
}
}
.hero {
margin-bottom: calc(var(--spacing) * 1);
padding-top: calc(var(--spacing) * 0.5);
padding: calc(var(--spacing) * 0.5) 0;
border-top: var(--border-light);
border-bottom: var(--border-light);
.p__baseline-big {
margin: 0;
@ -88,19 +175,19 @@
}
}
.add-to-cart,
.product-options {
.add-to-cart {
margin: 0;
border-bottom: var(--border-light);
padding: calc(var(--spacing) * 0.5) 0;
}
.product-options__label {
font-weight: 600;
margin-bottom: calc(var(--spacing) * 0.25);
}
.product-options {
border-bottom: var(--border-light);
padding: calc(var(--spacing) * 0.25) 0;
}
@media #{$small} {
.store__nav a {
padding-top: 0;
@ -110,6 +197,7 @@
.section__product {
display: flex;
flex-direction: column;
margin-bottom: 10vh;
.col-left {
display: contents;
@ -137,40 +225,47 @@
.add-to-cart {
order: 5;
}
.product-gallery{
width: 100vw;
position: relative;
left: calc(var(--padding-body)*-1);
.swiper-button-prev,
.swiper-button-next{ display: none; }
}
}
}
@media #{$small-up} {
.section__product{
display: grid;
grid-template-columns: 50% 50%;
aspect-ratio: 2/1;
margin-top: calc(var(--spacing) * 0.5);
position: relative;
.col-left {
padding-right: var(--padding-body);
}
grid-template-columns: 1fr 1fr;
gap: calc(var(--padding-body)*2);
margin-bottom: calc(var(--spacing)*3);
.details {
margin-bottom: calc(var(--spacing) * 3);
}
.add-to-cart,
.product-options {
width: calc(50% - var(--padding-body));
}
.add-to-cart {
position: absolute;
bottom: 10px;
margin-bottom: calc(var(--spacing) * 2);
flex-grow: 1;
}
.product-options {
position: absolute;
bottom: calc(var(--spacing) * 2);
border-top: var(--border-light);
}
.col-left{
min-height: 100%;
padding-bottom: 40px; //dots
display: flex;
flex-direction: column;
}
}
.product-gallery .swiper-slide figure{
width: calc(100% - 60px);
}
}

View file

@ -0,0 +1,31 @@
// Initialize Swiper for product gallery
document.addEventListener('DOMContentLoaded', function() {
const productGallery = document.querySelector('.product-gallery.swiper');
if (productGallery) {
const swiper = new Swiper('.product-gallery.swiper', {
// Enable loop if there are multiple slides
loop: true,
// Let CSS control the width
slidesPerView: 'auto',
// Navigation arrows
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
// Pagination dots
pagination: {
el: '.swiper-pagination',
clickable: true,
},
// Keyboard navigation
keyboard: {
enabled: true,
}
});
}
});

View file

@ -78,10 +78,18 @@
</div>
</div>
<?php if ($page->hasFiles()): ?>
<ul class="product-gallery">
<?php foreach($page->files()->sort() as $image): ?>
<li>
<div class="product-gallery swiper">
<div class="swiper-wrapper">
<?php
// Afficher les vraies images du produit
$realImages = $page->hasFiles() ? $page->files()->sortBy('sort', 'asc') : [];
$imageCount = 0;
// Afficher d'abord les vraies images
foreach($realImages as $image):
$imageCount++;
?>
<div class="swiper-slide">
<figure>
<?php snippet('picture', [
'file' => $image,
@ -91,11 +99,31 @@
'lazy' => false
]) ?>
</figure>
</li>
<?php endforeach ?>
</ul>
<?php endif ?>
</div>
<?php endforeach;
// Compléter avec des images temporaires si moins de 5 images
$colors = ['4ECDC4', '45B7D1', 'FFA07A', '98D8C8'];
while($imageCount < 5):
$colorIndex = $imageCount - count($realImages);
$imageCount++;
?>
<div class="swiper-slide">
<figure>
<img src="https://placehold.co/800x1000/<?= $colors[$colorIndex] ?>/ffffff?text=Image+<?= $imageCount ?>" alt="Image test <?= $imageCount ?>">
</figure>
</div>
<?php endwhile; ?>
</div>
<!-- Navigation arrows -->
<div class="swiper-button-prev"></div>
<div class="swiper-button-next"></div>
<!-- Pagination dots -->
<div class="swiper-pagination"></div>
</div>
</section>
</main>
<?php snippet('footer', ['scripts' => ['assets/js/product-size.js', 'assets/js/snipcart.js']]) ?>
<?php snippet('footer', ['scripts' => ['assets/js/product-size.js', 'assets/js/snipcart.js', 'assets/js/product-gallery.js']]) ?>

View file

@ -16,7 +16,7 @@ return array(
'PHPMailer\\PHPMailer\\' => array($vendorDir . '/phpmailer/phpmailer/src'),
'League\\ColorExtractor\\' => array($vendorDir . '/league/color-extractor/src'),
'Laminas\\Escaper\\' => array($vendorDir . '/laminas/laminas-escaper/src'),
'Kirby\\' => array($vendorDir . '/getkirby/composer-installer/src', $baseDir . '/kirby/src'),
'Kirby\\' => array($baseDir . '/kirby/src', $vendorDir . '/getkirby/composer-installer/src'),
'Composer\\Semver\\' => array($vendorDir . '/composer/semver/src'),
'Base32\\' => array($vendorDir . '/christian-riesen/base32/src'),
);

View file

@ -96,8 +96,8 @@ class ComposerStaticInit0b7fb803e22a45eb87e24172337208aa
),
'Kirby\\' =>
array (
0 => __DIR__ . '/..' . '/getkirby/composer-installer/src',
1 => __DIR__ . '/../..' . '/kirby/src',
0 => __DIR__ . '/../..' . '/kirby/src',
1 => __DIR__ . '/..' . '/getkirby/composer-installer/src',
),
'Composer\\Semver\\' =>
array (

View file

@ -1,9 +1,9 @@
<?php return array(
'root' => array(
'name' => 'getkirby/plainkit',
'pretty_version' => '5.1.4',
'version' => '5.1.4.0',
'reference' => null,
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'reference' => '44ed53aae0b7128526b1fe9c2c66e80b18df323f',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@ -65,9 +65,9 @@
'dev_requirement' => false,
),
'getkirby/plainkit' => array(
'pretty_version' => '5.1.4',
'version' => '5.1.4.0',
'reference' => null,
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'reference' => '44ed53aae0b7128526b1fe9c2c66e80b18df323f',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),