diff --git a/assets/base.css b/assets/base.css index c46963f6..8e19d782 100644 --- a/assets/base.css +++ b/assets/base.css @@ -225,131 +225,6 @@ button, background-color: inherit; } -.product-form__buttons { - display: flex; - flex-direction: column; - gap: 8px; - justify-content: flex-start; - align-items: flex-start; -} - -.button--add-to-cart { - border-radius: 4px; - padding-block: 12px; - padding-inline: 12px; -} - -.shopify-payment-button .shopify-payment-button__button { - width: 100%; - line-height: normal; - padding-block: 12px; -} - -.shopify-payment-button__button.shopify-payment-button__button--unbranded:hover:not([disabled]) { - background-color: rgba(var(--color-button), 0.9); -} - -.shopify-payment-button__more-options.shopify-payment-button__button--hidden { - display: none; -} - -.product-form__buttons > * { - width: 100%; -} - -/* Image block */ -.image-block img { - height: 100%; -} - -.image-block--cover img { - object-fit: cover; -} - -.image-block--contain img { - object-fit: contain; -} - -/* Text block */ -.text-block-subtitle { - font-size: 1.8rem; - line-height: calc(1 + 0.8 / var(--font-body-scale)); - letter-spacing: 0.06rem; - color: rgba(var(--color-foreground), 0.7); -} - -.text-block-caption { - font-size: 1rem; - letter-spacing: 0.13rem; - line-height: calc(1 + 0.2 / var(--font-body-scale)); - text-transform: uppercase; -} - -.field__input { - padding-block: 12px; - padding-inline: 8px; - border: 1px solid rgb(var(--color-foreground)); -} - -/* Image banner section */ -.image-banner { - position: relative; -} - -.image-banner--small { - min-height: 300px; -} - -.image-banner--medium { - min-height: 400px; -} - -.image-banner--large { - min-height: 500px; -} - -.image-banner > *:not(.image-banner__image-wrapper) { - z-index: 1; -} - -.image-banner__image-wrapper { - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - overflow: hidden; -} - -.image-banner__image-wrapper:after { - content: ""; - position: absolute; - top: 0; - background: #000000; - width: 100%; - height: 100%; -} - -.image-banner__image-wrapper .placeholder-image { - height: 100%; -} - -.image-banner--two-images .image-banner__image-wrapper img { - width: 50%; -} - -.image-banner--two-images .image-banner__image-wrapper img:last-child { - right: 0; -} - -.image-banner__image-wrapper img { - position: absolute; - object-fit: cover; - object-position: center; - height: 100%; -} - -/* Link block & links */ .link, a { display: inline-flex; @@ -366,23 +241,6 @@ a { text-decoration: underline; } -.link-block { - display: inline-flex; -} - -.link-block-icon-right { - flex-direction: row-reverse; - justify-content: flex-end; -} - -.link-block svg { - fill: rgb(var(--fill-link-icon-color)); -} - -.link--with-icon { - gap: 5px; -} - /* Resource card (product, collection) */ .resource-card { text-decoration: none; @@ -406,491 +264,6 @@ a { position: relative; } -/* Newsletter block */ -.newsletter-block { - position: relative; - overflow: auto; -} - -.newsletter-block .contact-form { - width: max(150px, 100%); - min-height: 44px; -} - -.newsletter-block__form-inputs { - position: relative; -} - -.newsletter-block input { - width: 100%; - padding: 22px 44px 8px 12px; - background: var(--gradient-background); - color: rgb(var(--color-foreground)); -} - -.newsletter-block label { - position: absolute; - top: 50%; - transform: translateY(-50%); - left: 12px; - transition: all 0.2s ease-in-out; -} - -.newsletter-block input::placeholder { - opacity: 0; -} - -.newsletter-block input:focus + label, -.newsletter-block input:not(:placeholder-shown) + label { - font-size: 0.8rem; - transform: translateY(-120%); -} - -.newsletter-block button { - position: absolute; - top: 0; - right: 0; - height: 100%; - min-width: 44px; - padding-inline: 0; - background-color: transparent; - color: var(--color-foreground); -} - -.newsletter-block svg { - width: 15px; -} - -/* Price block */ -.price-block { - display: flex; - gap: 5px; - width: fit-content; -} - -/* Product medias block */ -.media-block { - display: flex; - width: 100%; - height: 100%; - overflow: hidden; -} - -.layout--row > .media-block { - align-self: flex-start; -} - -.media-block:where(.column) { - flex-direction: column; -} - -.media-block > div { - display: flex; -} - -.media-block:not(.column) > div { - flex-grow: 1; -} - -.media-block:has(div:nth-child(2)) { - flex-wrap: wrap; -} - -.media-block > div:not(:only-child) { - max-width: 50%; -} - -.media-block.column > div { - max-width: 100%; - width: 100%; -} - -.media-block .placeholder-image svg { - position: relative; -} - -/* Quantity selector block */ -.quantity-block label { - display: inline-block; - padding-block: 8px; -} - -.quantity-button-wrapper { - display: flex; - align-items: stretch; -} - -.minus-button { - border-start-start-radius: 4px; - border-end-start-radius: 4px; -} - -.plus-button { - border-start-end-radius: 4px; - border-end-end-radius: 4px; -} - -.quantity-button { - width: min(25%, fit-content); - border: 1px solid #000; - background-color: #fff; - padding: 12px; - font-size: calc(var(--font-body-scale) * 1.8rem); -} - -.quantity-input { - width: 100%; - border-inline-width: 0px; - border-block-width: 1px; - padding: 12px; - color: currentColor; - font-size: calc(var(--font-body-scale) * 1.6rem); - font-weight: 500; - text-align: center; - background-color: #fff; - width: 100%; - flex-grow: 1; - -webkit-appearance: none; - appearance: none; -} - -.quantity-input::-webkit-outer-spin-button, -.quantity-input::-webkit-inner-spin-button { - -webkit-appearance: none; - margin: 0; -} - -.quantity-input[type="number"] { - -moz-appearance: textfield; -} - -/* Variant picker block */ -.variant-block label { - display: inline-block; - padding-block: 8px; -} - -.variant-select { - position: relative; -} - -.variant-select svg { - position: absolute; - height: 6px; - top: 50%; - transform: translatey(-50%); - right: 1rem; - pointer-events: none; -} - -.variant-block select { - width: 100%; - padding-block: 12px; - padding-inline: 10px 30px; - border-radius: 4px; - border: 1px solid #000; - appearance: none; -} - -/* Payment icons block */ -.payment-icons__list { - display: flex; - gap: 10px; - flex-wrap: wrap; - justify-content: center; -} - -/* Collapsible row */ -details { - width: 100%; - border-block-start: 1px solid rgba(var(--color-foreground), 0.08); -} - -summary { - display: flex; - align-items: center; - gap: 1.5rem; - position: relative; - padding-block: 1.5rem; - padding-inline: 0; - cursor: pointer; - list-style: none; -} - -summary:hover { - text-decoration: underline; - background-color: rgba(var(--color-foreground), 0.04); -} - -summary .icon-caret { - margin-inline-start: auto; - height: 0.6rem; - margin-right: 1.5rem; -} - -details[open] > summary .icon-caret { - transform: rotate(180deg); -} - -/* Icon */ -.icon-block { - display: flex; - fill: currentColor; -} - -.icon-block > svg, -.icon-block > img { - height: auto; -} - -/* Slideshow */ -slideshow-component { - display: block; - width: 100%; -} - -/* Slides container */ -.slideshow__slides { - display: grid; - overflow: hidden; - width: 100%; - grid-template-areas: "slide"; -} - -.slideshow--small .slideshow__slides { - min-height: 28rem; -} - -.slideshow--medium .slideshow__slides { - min-height: 34rem; -} - -.slideshow--large .slideshow__slides { - min-height: 39rem; -} - -@media screen and (min-width: 750px) { - .slideshow--small .slideshow__slides { - min-height: 42rem; - } - - .slideshow--medium .slideshow__slides { - min-height: 56rem; - } - - .slideshow--large .slideshow__slides { - min-height: 72rem; - } -} - -/* Individual slides */ -.slideshow__slide { - display: flex; - position: relative; - grid-area: slide; - justify-content: center; - align-items: center; - width: 100%; -} - -slideshow-component .slideshow__slide { - height: 100%; -} - -.slideshow__slide[aria-hidden="true"] { - order: 0; -} - -:is(.slideshow__slide.slide--next, .slideshow__slide.slide--previous) { - order: 1; - z-index: 1; -} - -.slideshow__slide[aria-hidden="false"] { - order: 2; - z-index: 2; -} - -.slide--transition-out-next, -.slide--transition-out-previous, -.slide--next, -.slide--previous { - animation-duration: 0.5s; - animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1); -} - -.slide--next, -.slide--previous { - animation-fill-mode: forwards; -} - -.slide--transition-out-next { - animation-name: slideOutRight; -} - -.slide--transition-out-previous { - animation-name: slideOutLeft; -} - -.slideshow__slide.slide--next { - animation-name: slideInLeft; -} - -.slideshow__slide.slide--previous { - animation-name: slideInRight; -} - -/* Slide content */ -.slide__content { - display: flex; - position: relative; - padding: 3.2rem; - width: 100%; - height: 100%; -} - -.slide__content > * { - margin: auto; - max-height: 100%; -} - -.slideshow__slide > .slide__image-container { - display: flex; - width: 100%; - height: 100%; - overflow: hidden; - position: absolute; -} - -.slide__image-container svg { - width: 100%; -} - -.slide__image-container img { - object-fit: cover; -} - -/* Slideshow controls */ -.slideshow__controls { - display: flex; - align-items: center; - justify-content: center; -} - -.current-slide-indicator { - display: flex; - justify-content: center; - min-width: 4.4rem; - transition: transform 0.2s ease-in-out; -} - -.slideshow-controls__dot { - width: 1rem; - height: 1rem; - border-radius: 50%; - border: 0.1rem solid black; - padding: 0; - display: block; - background-color: transparent; -} - -:where(.slideshow-controls__link--active) .slideshow-controls__dot { - background-color: rgba(var(--color-foreground), 1); -} - -.slideshow__controls .button-secondary { - display: inline-flex; - justify-content: center; - align-items: center; - padding: 1rem; - border: none; - min-height: 4.4rem; - min-width: 4.4rem; - color: rgb(var(--color-foreground)); -} - -.slideshow-control .icon { - display: block; - position: absolute; - opacity: 1; - transform: scale(1); - transition: transform 150ms ease, opacity 150ms ease; - width: 1.8rem; - height: 1.2rem; -} - -.slideshow-controls__link { - cursor: pointer; - display: inline-block; - border: none; - color: rgba(var(--color-foreground), 0.5); - box-shadow: none; - background-color: transparent; - font-size: 1.4rem; - font-family: inherit; - padding: 1.28rem; -} - -:where(.slideshow-controls__link--active).slideshow-controls__link { - color: rgba(var(--color-foreground), 1); -} - -/* Autoplay */ -.slideshow-control--autoplay { - position: absolute; - right: 0; -} - -@media screen and (min-width: 750px) { - .slideshow-control--autoplay { - position: inherit; - } -} - -.slideshow-control--autoplay--paused .icon-pause, -.slideshow-control--autoplay:not(.slideshow-control--autoplay--paused) .icon-play { - visibility: hidden; - opacity: 0; - transform: scale(0.8); -} - -/* Animation declarations */ -@keyframes slideInLeft { - from { - transform: translateX(100%); - } - to { - transform: translateX(0); - } -} - -@keyframes slideOutRight { - from { - transform: translateX(0); - } - to { - transform: translateX(-100%); - } -} - -@keyframes slideInRight { - from { - transform: translateX(-100%); - } - to { - transform: translateX(0); - } -} - -@keyframes slideOutLeft { - from { - transform: translateX(0); - } - to { - transform: translateX(100%); - } -} - /* Product grid */ .product-grid { --product-grid-gap: 20px; @@ -911,89 +284,3 @@ slideshow-component .slideshow__slide { grid-template-columns: var(--product-grid-columns-desktop); } } - -/* Pagination */ -.pagination-wrapper { - margin-top: 4rem; -} - -@media screen and (min-width: 990px) { - .pagination-wrapper { - margin-top: 5rem; - } -} - -.pagination__list { - display: flex; - flex-wrap: wrap; - justify-content: center; -} - -.pagination__list > li { - flex: 1 0 4.4rem; - max-width: 4.4rem; -} - -.pagination__item { - color: rgb(var(--color-foreground)); - display: inline-flex; - justify-content: center; - align-items: center; - position: relative; - height: 4.4rem; - width: 100%; - padding: 0; - text-decoration: none; -} - -.pagination__item.link:hover { - text-decoration: none; -} - -a.pagination__item:hover::after { - height: 0.1rem; -} - -.pagination__item .icon-caret { - height: 0.6rem; -} - -.pagination__item--current::after { - height: 0.1rem; -} - -.pagination__item--current::after, -.pagination__item:hover::after { - content: ""; - display: block; - width: 2rem; - position: absolute; - bottom: 8px; - left: 50%; - transform: translateX(-50%); - background-color: currentColor; -} - -.pagination__item--next .icon { - transform: rotate(-90deg); -} - -.pagination__item--next:hover .icon { - transform: rotate(-90deg) scale(1.07); -} - -.pagination__item--prev .icon { - transform: rotate(90deg); -} - -.pagination__item--prev:hover .icon { - transform: rotate(90deg) scale(1.07); -} - -.filters-wrapper { - display: flex; - justify-content: flex-end; - align-items: center; - margin-bottom: 1rem; - gap: 20px; -} diff --git a/assets/global.js b/assets/global.js deleted file mode 100644 index 59be89b0..00000000 --- a/assets/global.js +++ /dev/null @@ -1,223 +0,0 @@ -const inputChangeEvent = new CustomEvent('inputChangeEvent', { bubbles: true }); -class ProductInputs extends HTMLElement { - constructor() { - super(); - this.sectionId = this.dataset.section; - this.section = this.closest('.shopify-section'); - this.hiddenInputs = this.section.querySelectorAll(`[id^="product-form-${this.sectionId }"] input[name="${ this.dataset.inputName }"]`); - this.inputElement = this.querySelector(`[name="${ this.dataset.inputName }"]`); - - this.addEventListener('change', this.onInputChange); - this.section.addEventListener('inputChangeEvent', (event) => { - console.log(event.target); - this.updateHiddenInputs(); - }); - } - - onInputChange() { - this.dispatchEvent(inputChangeEvent); - } - - updateHiddenInputs() { - this.hiddenInputs.forEach((hiddenInput) => { - hiddenInput.value = this.inputElement.value; - }); - } -} - -customElements.define('product-inputs', ProductInputs); - - -class QuantityInput extends HTMLElement { - constructor() { - super(); - this.minusButton = this.querySelector('[name="minus"]'); - this.plusButton = this.querySelector('[name="plus"]'); - this.inputElement = this.querySelector('input'); - [this.minusButton, this.plusButton].forEach((button) => { - button.addEventListener('click', this.onButtonClick.bind(this)); - }); - } - - onButtonClick(event) { - event.preventDefault(); - const currentValue = parseInt(this.inputElement.value); - const newValue = event.target.name === 'plus' ? currentValue + 1 : currentValue - 1; - this.inputElement.value = newValue > 0 ? newValue : 1; - this.inputElement.dispatchEvent(inputChangeEvent); - } -} - -customElements.define('quantity-input', QuantityInput); - -// Slideshow component -class SlideshowComponent extends HTMLElement { - constructor() { - super(); - this.slides = this.querySelectorAll(".slideshow__slide"); - if ( this.slides.length <= 1) return; - - this.currentSlideIndicator = this.querySelector(".current-slide-indicator"); - this.currentSlideIndex = this.dataset.activeSlide; - this.counterControls = this.querySelectorAll(".slideshow-controls__link"); - - this.nextControl = this.querySelector(".slideshow-control--next"); - this.previousControl = this.querySelector(".slideshow-control--previous"); - - if (this.getAttribute('data-autoplay') === 'true') { - this.autoplaySpeed = parseInt(this.dataset.autoplaySpeed) * 1000; - this.isAutoplayButtonSetToPlay = true; - this.setAutoPlay(); - } - - this.initButtons(); - } - - initButtons() { - this.nextControl.addEventListener("click", () => { - this.updateSlideshow('next'); - this.resetAutoPlay(); - }); - - this.previousControl.addEventListener("click", () => { - this.updateSlideshow('previous'); - this.resetAutoPlay(); - }); - - this.counterControls.forEach(control => { - control.addEventListener("click", () => { - if (this.currentSlideIndex == control.dataset.slideNumber) return; - this.updateSlideshow(control.dataset.slideNumber); - this.resetAutoPlay(); - }); - }); - } - - updateSlideshow(target = 'next') { - let nextSlideIndex = 0; - let transitionDirection = target; - - switch (target) { - case 'next': - nextSlideIndex = parseInt(this.dataset.activeSlide) + 1; - break; - case 'previous': - nextSlideIndex = parseInt(this.dataset.activeSlide) - 1; - break; - default: - nextSlideIndex = target; - transitionDirection = nextSlideIndex > this.dataset.activeSlide ? 'next' : 'previous'; - break; - } - - if (nextSlideIndex < 0) { - nextSlideIndex = this.slides.length - 1; - } - else if (nextSlideIndex >= this.slides.length) { - nextSlideIndex = 0; - } - - this.slideTransition(this.slides[this.dataset.activeSlide], this.slides[nextSlideIndex], transitionDirection); - this.updateControls(nextSlideIndex); - this.dataset.activeSlide = nextSlideIndex; - this.currentSlideIndex = nextSlideIndex; - } - - slideTransition(currentSlide, nextSlide, transitionDirection) { - const slideshowControls = this.querySelectorAll('.slideshow-control'); - slideshowControls.forEach((control) => { control.setAttribute('disabled', 'true')}); - - currentSlide.addEventListener('animationend', (event) => { - if (event.animationName.includes('slideIn')) return; - - // Hide slides & reset transitions - this.slides.forEach((slide) => { - slide.setAttribute('aria-hidden', 'true'); - slide.classList.remove(`slide--transition-out-${transitionDirection}`); - }); - - // Set new slide to active - nextSlide.setAttribute('aria-hidden', 'false'); - nextSlide.classList.remove(`slide--${transitionDirection}`); - slideshowControls.forEach(control => { control.removeAttribute('disabled')}); - }); - - // Start slide transition - currentSlide.classList.add(`slide--transition-out-${transitionDirection}`); - nextSlide.classList.add(`slide--${transitionDirection}`); - } - - updateControls(newSlideIndex) { - // If we have a current slide indicator (i.e. 2/3), update it - if (this.currentSlideIndicator) { - this.currentSlideIndicator.innerText = `${newSlideIndex + 1}/${this.slides.length}`; - return; - } - - this.counterControls.forEach(control => { control.classList.remove("slideshow-controls__link--active")}); - this.counterControls[newSlideIndex].classList.add("slideshow-controls__link--active"); - } - - resetAutoPlay() { - if (this.isAutoplayButtonSetToPlay) { - this.play(); - } - } - - /* Handle autoplay */ - setAutoPlay() { - this.addEventListener('mouseover', this.focusInHandling.bind(this)); - this.addEventListener('mouseleave', this.focusOutHandling.bind(this)); - this.addEventListener('focusin', this.focusInHandling.bind(this)); - this.addEventListener('focusout', this.focusOutHandling.bind(this)); - - this.sliderAutoplayButton = this.querySelector('.slideshow-control--autoplay'); - this.sliderAutoplayButton.addEventListener('click', this.autoPlayToggle.bind(this)); - this.isAutoplayButtonSetToPlay = true; - this.play(); - } - - autoPlayToggle() { - this.togglePlayButtonState(this.isAutoplayButtonSetToPlay); - this.isAutoplayButtonSetToPlay ? this.pause() : this.play(); - this.isAutoplayButtonSetToPlay = !this.isAutoplayButtonSetToPlay; - } - - togglePlayButtonState(pauseAutoplay) { - this.sliderAutoplayButton.classList.toggle('slideshow-control--autoplay--paused', pauseAutoplay); - (pauseAutoplay) ? this.sliderAutoplayButton.setAttribute('aria-label', 'Play slideshow') : this.sliderAutoplayButton.setAttribute('aria-label', 'Pause slideshow'); - } - - play() { - this.setAttribute('aria-live', 'off'); - clearInterval(this.autoplay); - this.autoplay = setInterval(this.autoRotateSlides.bind(this), this.autoplaySpeed); - } - - pause() { - this.setAttribute('aria-live', 'polite'); - clearInterval(this.autoplay); - } - - autoRotateSlides() { - this.updateSlideshow('next'); - } - - focusOutHandling(event) { - const focusedOnAutoplayButton = - event.target === this.sliderAutoplayButton || this.sliderAutoplayButton.contains(event.target); - - if (this.isAutoplayButtonSetToPlay && !focusedOnAutoplayButton) this.play(); - } - - focusInHandling(event) { - const focusedOnAutoplayButton = - event.target === this.sliderAutoplayButton || this.sliderAutoplayButton.contains(event.target); - - if (this.isAutoplayButtonSetToPlay) { - focusedOnAutoplayButton ? this.play() : this.pause(); - } - } -}; - -customElements.define('slideshow-component', SlideshowComponent); diff --git a/blocks/_slide.liquid b/blocks/_slide.liquid index f2fea6a1..3c01ce68 100644 --- a/blocks/_slide.liquid +++ b/blocks/_slide.liquid @@ -53,7 +53,7 @@ {%- endif -%}
@@ -117,10 +117,9 @@ }, "blocks": [ { - "type": "heading", + "type": "text", "settings": { - "heading": "Image slide", - "heading_size": "h1" + "text": "