Skip to content

Commit

Permalink
Quickview vanilla.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Oksydan committed Oct 9, 2023
1 parent b5a66ff commit d7260df
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions _dev/js/theme/components/quickview.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
import $ from 'jquery';
import prestashop from 'prestashop';
import DOMReady from '../utils/DOMReady';
import parseToHtml from '../utils/parseToHtml';

/**
* Handle open quick view
*/
const handleQuickViewOpen = ({
resp,
}) => {
const body = document.querySelector('body');
body.append(parseToHtml(resp.quickview_html));
const handleQuickViewOpen = ({ resp }) => {
const body = document.body;

Check failure on line 9 in _dev/js/theme/components/quickview.js

View workflow job for this annotation

GitHub Actions / Code quality - ESLint

Use object destructuring

// TO DO REMOVE JQUERY
const productModal = $(
`#quickview-modal-${resp.product.id}-${resp.product.id_product_attribute}`,
);
productModal.modal('show');
const quickviewHtml = parseToHtml(resp.quickview_html);
body.appendChild(quickviewHtml);

const productModal = document.getElementById(`quickview-modal-${resp.product.id}-${resp.product.id_product_attribute}`);
productModal.classList.add('show');

body.classList.add('js-quickview-open');

productModal.on('hidden.bs.modal', () => {
productModal.addEventListener('hidden.bs.modal', () => {
productModal.remove();
body.classList.remove('js-quickview-open');
});
Expand Down

0 comments on commit d7260df

Please sign in to comment.