[Shop] Add image lightbox (#17159)

This one added lightbox script to the main image, but thumbs/variants
need rework
This commit is contained in:
Grzegorz Sadowski 2024-10-09 12:55:54 +02:00 committed by GitHub
commit 358e442df3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 15 additions and 3 deletions

View file

@ -12,6 +12,7 @@ import './styles/main.scss';
import './app';
import './scripts/bootstrap';
import './scripts/spotlight';
const imagesContext = require.context('./images', true, /\.(jpg|jpeg|png|svg|gif)$/);
imagesContext.keys().forEach(imagesContext);

View file

@ -0,0 +1,10 @@
/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
import 'spotlight.js';

View file

@ -9,7 +9,8 @@
"@symfony/stimulus-bridge": "^3.2.2",
"@symfony/webpack-encore": "^3.1.0",
"bootstrap": "^5.3.0",
"flag-icons": "^7.2.3"
"flag-icons": "^7.2.3",
"spotlight.js": "^0.7.8"
},
"devDependencies": {
"sass": "^1.54.8",

View file

@ -9,7 +9,7 @@
{% set path = original_path %}
{% endif %}
<div class="mb-5">
<div class="spotlight-group mb-5">
<div data-product-image="{{ path }}" data-product-link="{{ original_path }}"></div>
{% hook 'images' with { original_path, path } %}
</div>

View file

@ -1,6 +1,6 @@
{% set product = hookable_metadata.context.product %}
<a href="{{ hookable_metadata.context.original_path }}">
<a href="{{ hookable_metadata.context.original_path }}" class="spotlight">
<img src="{{ hookable_metadata.context.path }}" alt="{{ product.name }}"
{% if product.images.first %}
{{ sylius_test_html_attribute('main-image', product.images.first.type) }}