Demas ajustes
This commit is contained in:
+13
-327
@@ -116,6 +116,7 @@
|
||||
type="button"
|
||||
data-wishlist
|
||||
data-product-id="{{ product.id }}"
|
||||
data-product-handle="{{ product.handle }}"
|
||||
aria-pressed="false"
|
||||
aria-label="{{ 'bestsellers.save' | t: product: product.title }}"
|
||||
data-label-save="{{ 'bestsellers.save' | t: product: product.title }}"
|
||||
@@ -174,330 +175,6 @@
|
||||
</div>
|
||||
</article>
|
||||
|
||||
{% stylesheet %}
|
||||
.collection-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 15px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.collection-card__media {
|
||||
position: relative;
|
||||
aspect-ratio: 1;
|
||||
overflow: hidden;
|
||||
border-radius: 10px;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.collection-card__link {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.collection-card__image {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.collection-card__image--hover {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
opacity: 0;
|
||||
transition: opacity 0.35s ease;
|
||||
}
|
||||
|
||||
.collection-card__media:hover .collection-card__image--hover,
|
||||
.collection-card__media:focus-within .collection-card__image--hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.collection-card__image--empty {
|
||||
background: #f3f3f3;
|
||||
}
|
||||
|
||||
.collection-card__badges {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
left: 10px;
|
||||
z-index: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.collection-card__badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 3px 5px;
|
||||
border-radius: 2px;
|
||||
color: #000;
|
||||
font-size: 10px;
|
||||
font-weight: 300;
|
||||
line-height: normal;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.collection-card__badge--best {
|
||||
background: #bfffb2;
|
||||
}
|
||||
|
||||
.collection-card__badge--skin {
|
||||
background: #f7c585;
|
||||
}
|
||||
|
||||
.collection-card__wish {
|
||||
position: absolute;
|
||||
top: 16px;
|
||||
right: 16px;
|
||||
z-index: 2;
|
||||
display: grid;
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
place-items: center;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.collection-card__wish svg {
|
||||
display: block;
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
}
|
||||
|
||||
.collection-card__wish.is-active svg path {
|
||||
fill: #000;
|
||||
}
|
||||
|
||||
.collection-card__actions {
|
||||
position: absolute;
|
||||
right: 16px;
|
||||
bottom: 16px;
|
||||
left: 16px;
|
||||
z-index: 2;
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
margin: 0;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transition: opacity 0.25s ease;
|
||||
}
|
||||
|
||||
.collection-card__media:hover .collection-card__actions,
|
||||
.collection-card__media:focus-within .collection-card__actions {
|
||||
opacity: 1;
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
.collection-card__add,
|
||||
.collection-card__buy {
|
||||
flex: 1 1 0;
|
||||
height: 48px;
|
||||
border-radius: 60px;
|
||||
font: inherit;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
line-height: 1;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.collection-card__add {
|
||||
border: 1px solid #111;
|
||||
background: #fff;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.collection-card__buy {
|
||||
border: 0;
|
||||
background: #9dd6c7;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.collection-card__add:disabled,
|
||||
.collection-card__buy:disabled {
|
||||
cursor: default;
|
||||
opacity: 0.55;
|
||||
}
|
||||
|
||||
.collection-card__info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 5px;
|
||||
}
|
||||
|
||||
.collection-card__title {
|
||||
color: #000;
|
||||
font-size: 22px;
|
||||
font-weight: 700;
|
||||
line-height: normal;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.collection-card__subtitle,
|
||||
.collection-card__reviews,
|
||||
.collection-card__prices {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.collection-card__subtitle {
|
||||
color: #808181;
|
||||
font-size: 18px;
|
||||
font-weight: 300;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.collection-card__rating {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.collection-card__stars {
|
||||
display: flex;
|
||||
gap: 1px;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.collection-card__star {
|
||||
display: block;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
}
|
||||
|
||||
.collection-card__star.is-off {
|
||||
opacity: 0.25;
|
||||
}
|
||||
|
||||
.collection-card__reviews {
|
||||
color: #000;
|
||||
font-size: 14px;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
.collection-card__prices {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.collection-card__price,
|
||||
.collection-card__compare {
|
||||
font-size: 20px;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.collection-card__price {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.collection-card__compare {
|
||||
color: #808181;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.recent .collection-card__title {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.recent .collection-card__subtitle,
|
||||
.recent .collection-card__reviews {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.recent .collection-card__price,
|
||||
.recent .collection-card__compare {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.recent .collection-card__star {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.collection-card {
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.collection-card__media {
|
||||
aspect-ratio: auto;
|
||||
overflow: visible;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.collection-card__link {
|
||||
position: relative;
|
||||
aspect-ratio: 1;
|
||||
overflow: hidden;
|
||||
border-radius: 10px;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.collection-card__image {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
}
|
||||
|
||||
.collection-card__actions {
|
||||
position: static;
|
||||
opacity: 1;
|
||||
pointer-events: auto;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.collection-card__add,
|
||||
.collection-card__buy {
|
||||
height: 36px;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.collection-card__title,
|
||||
.recent .collection-card__title {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.collection-card__subtitle,
|
||||
.recent .collection-card__subtitle {
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.collection-card__price,
|
||||
.collection-card__compare,
|
||||
.recent .collection-card__price,
|
||||
.recent .collection-card__compare {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.collection-card__reviews,
|
||||
.recent .collection-card__reviews {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.collection-card__wish {
|
||||
top: 8px;
|
||||
right: 8px;
|
||||
}
|
||||
|
||||
.collection-card__wish svg {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.collection-card__image--hover,
|
||||
.collection-card__actions {
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
{% endstylesheet %}
|
||||
|
||||
{% javascript %}
|
||||
(() => {
|
||||
if (window.__seasonCollectionCard) return;
|
||||
@@ -508,14 +185,18 @@
|
||||
const readWishlist = () => {
|
||||
try {
|
||||
const stored = JSON.parse(window.localStorage.getItem(wishlistKey));
|
||||
return Array.isArray(stored) ? stored.map(String) : [];
|
||||
if (!Array.isArray(stored)) return [];
|
||||
return stored.map((item) => {
|
||||
if (item && typeof item === 'object') return { id: String(item.id || ''), handle: String(item.handle || '') };
|
||||
return { id: String(item), handle: '' };
|
||||
}).filter((item) => item.id);
|
||||
} catch (error) {
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
const applyWishlist = () => {
|
||||
const saved = readWishlist();
|
||||
const saved = readWishlist().map((item) => item.id);
|
||||
document.querySelectorAll('.collection-card [data-wishlist]').forEach((button) => {
|
||||
const active = saved.includes(String(button.dataset.productId));
|
||||
button.classList.toggle('is-active', active);
|
||||
@@ -526,15 +207,20 @@
|
||||
};
|
||||
|
||||
applyWishlist();
|
||||
document.addEventListener('seasons:wishlist', applyWishlist);
|
||||
|
||||
document.addEventListener('click', (event) => {
|
||||
const wish = event.target.closest('.collection-card [data-wishlist]');
|
||||
if (!wish) return;
|
||||
const id = String(wish.dataset.productId || '');
|
||||
const handle = String(wish.dataset.productHandle || '');
|
||||
if (!id) return;
|
||||
const saved = readWishlist();
|
||||
const next = saved.includes(id) ? saved.filter((item) => item !== id) : saved.concat(id);
|
||||
const next = saved.some((item) => item.id === id)
|
||||
? saved.filter((item) => item.id !== id)
|
||||
: saved.concat({ id, handle });
|
||||
window.localStorage.setItem(wishlistKey, JSON.stringify(next));
|
||||
document.dispatchEvent(new CustomEvent('seasons:wishlist'));
|
||||
applyWishlist();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user