Skip to content

Commit

Permalink
update browserlist
Browse files Browse the repository at this point in the history
  • Loading branch information
hectorfhurtado committed Aug 22, 2023
2 parents c5bffe0 + 6881433 commit 3ed402e
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 7 deletions.
14 changes: 14 additions & 0 deletions assets/js/theme/custom/toggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,20 @@ function updateAttributes($element) {
// If the attribute doesn't exists, it defaults to false which is desirable
const ariaExpanded = $element.getAttribute('aria-expanded') === 'true'
$element.setAttribute('aria-expanded', !ariaExpanded)

/* eslint-disable no-param-reassign */
if ('hasUHidden' in $element.dataset) {
$element.classList.add('u-hidden')
delete $element.dataset.hasUHidden

return
}

if ($element.classList.contains('u-hidden')) {
$element.classList.remove('u-hidden')
$element.dataset.hasUHidden = true
}
/* eslint-enable no-param-reassign */
}

/**
Expand Down
4 changes: 4 additions & 0 deletions assets/js/theme/product.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { classifyForm } from './common/utils/form-utils'
import modalFactory from './global/modal'
import q$, { q$$ } from './global/selector'
import trigger from './common/utils/trigger'
import toggle from './custom/toggle'

export default class Product extends PageManager {
constructor(context) {
Expand Down Expand Up @@ -46,6 +47,9 @@ export default class Product extends PageManager {

const review = new Review({ $reviewForm })

toggle('[data-reveal-id="modal-review-form"]', { update: ['#modal-review-form'] })
toggle('#modal-review-form .js-modal-review-close', { update: ['#modal-review-form'] })

q$('[data-reveal-id="modal-review-form"]').addEventListener('click', () => {
validator = review.registerValidation(this.context)
this.ariaDescribeReviewInputs($reviewForm)
Expand Down
2 changes: 0 additions & 2 deletions assets/scss/components/_wishlist-dropdown.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
========================================================================== */

.c-wishlist-dropdown {
position: relative;

> ul {
display: none;

Expand Down
12 changes: 10 additions & 2 deletions templates/components/products/modals/writeReview.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div id="js-modal-review-form" class="js-reveal u-hidden">
<div id="modal-review-form" class="js-reveal u-hidden">
{{inject 'reviewRating' (lang 'forms.validate.reviews.rating')}}
{{inject 'reviewSubject' (lang 'forms.validate.reviews.title')}}
{{inject 'reviewComment' (lang 'forms.validate.reviews.comment')}}
Expand All @@ -7,7 +7,15 @@
<div class="js-modal-header-title">
{{lang 'products.reviews.write_a_review'}}
</div>
{{> components/common/modal/modal-close-btn}}
<button
class="js-modal-review-close"
type="button"
title="{{lang 'common.close'}}"
{{additional_attr}}
>
<span class="u-hidden-visually">{{lang 'common.close'}}</span>
<span aria-hidden="true">&#215;</span>
</button>
</div>
<div class="js-modal-body">
<div>
Expand Down
7 changes: 4 additions & 3 deletions templates/components/products/product-view.html
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,11 @@ <h1 class="js-product-view-title">
{{/if}}
{{#if settings.show_product_reviews}}
<a
href="{{product.url}}{{#if is_ajax}}#write_review{{/if}}"
{{#unless is_ajax}}
{{#if is_ajax}}
href="{{product.url}}#write_review"
{{else}}
data-reveal-id="modal-review-form"
{{/unless}}
{{/if}}
role="button"
>
{{lang 'products.reviews.new'}}
Expand Down

0 comments on commit 3ed402e

Please sign in to comment.