add css image loading improvements
This commit is contained in:
@@ -172,7 +172,6 @@ body.sf-body {
|
|||||||
|
|
||||||
img {
|
img {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
height: auto;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
@@ -866,10 +865,14 @@ a:hover {
|
|||||||
|
|
||||||
.sf-product-card__media-link {
|
.sf-product-card__media-link {
|
||||||
display: block;
|
display: block;
|
||||||
|
aspect-ratio: 1;
|
||||||
|
background: var(--sf-surface-muted);
|
||||||
|
border-radius: var(--sf-radius-sm);
|
||||||
}
|
}
|
||||||
|
|
||||||
.sf-product-card__image {
|
.sf-product-card__image {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
aspect-ratio: 1;
|
aspect-ratio: 1;
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
border-radius: var(--sf-radius-sm);
|
border-radius: var(--sf-radius-sm);
|
||||||
@@ -961,6 +964,7 @@ a:hover {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: auto;
|
height: auto;
|
||||||
aspect-ratio: 1;
|
aspect-ratio: 1;
|
||||||
|
background: var(--sf-surface-muted);
|
||||||
}
|
}
|
||||||
|
|
||||||
.sf-variant-link--sm {
|
.sf-variant-link--sm {
|
||||||
@@ -1054,6 +1058,7 @@ a:hover {
|
|||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
border-radius: var(--sf-radius);
|
border-radius: var(--sf-radius);
|
||||||
border: 1px solid var(--sf-border);
|
border: 1px solid var(--sf-border);
|
||||||
|
background: var(--sf-surface-muted);
|
||||||
}
|
}
|
||||||
|
|
||||||
.sf-product-gallery__thumbs {
|
.sf-product-gallery__thumbs {
|
||||||
@@ -1069,6 +1074,7 @@ a:hover {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.sf-prose img {
|
.sf-prose img {
|
||||||
|
height: auto;
|
||||||
border-radius: var(--sf-radius-sm);
|
border-radius: var(--sf-radius-sm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,13 @@
|
|||||||
<div class='sf-thumb'>
|
<div class='sf-thumb'>
|
||||||
<a href='/shop/products/{{productId}}/variants/{{id}}'>
|
<a href='/shop/products/{{productId}}/variants/{{id}}'>
|
||||||
{{#if thumbnailUrl}}
|
{{#if thumbnailUrl}}
|
||||||
<img src='{{thumbnailUrl}}' alt='{{productTitle}} — {{title}}' />
|
{{> storefront-image
|
||||||
|
src=thumbnailUrl
|
||||||
|
alt=''
|
||||||
|
width='1'
|
||||||
|
height='1'
|
||||||
|
loading='lazy'
|
||||||
|
}}
|
||||||
{{else}}
|
{{else}}
|
||||||
<span class='sf-thumb__placeholder'>no image</span>
|
<span class='sf-thumb__placeholder'>no image</span>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|||||||
@@ -4,14 +4,26 @@
|
|||||||
{{#if linkHref}}
|
{{#if linkHref}}
|
||||||
<a href='{{linkHref}}'>
|
<a href='{{linkHref}}'>
|
||||||
{{#if thumbnailUrl}}
|
{{#if thumbnailUrl}}
|
||||||
<img src='{{thumbnailUrl}}' alt='{{productTitle}} — {{variantTitle}}' />
|
{{> storefront-image
|
||||||
|
src=thumbnailUrl
|
||||||
|
alt=''
|
||||||
|
width='1'
|
||||||
|
height='1'
|
||||||
|
loading='lazy'
|
||||||
|
}}
|
||||||
{{else}}
|
{{else}}
|
||||||
<span class='sf-thumb__placeholder'>no image</span>
|
<span class='sf-thumb__placeholder'>no image</span>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</a>
|
</a>
|
||||||
{{else}}
|
{{else}}
|
||||||
{{#if thumbnailUrl}}
|
{{#if thumbnailUrl}}
|
||||||
<img src='{{thumbnailUrl}}' alt='{{productTitle}} — {{variantTitle}}' />
|
{{> storefront-image
|
||||||
|
src=thumbnailUrl
|
||||||
|
alt=''
|
||||||
|
width='1'
|
||||||
|
height='1'
|
||||||
|
loading='lazy'
|
||||||
|
}}
|
||||||
{{else}}
|
{{else}}
|
||||||
<span class='sf-thumb__placeholder'>no image</span>
|
<span class='sf-thumb__placeholder'>no image</span>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|||||||
@@ -4,14 +4,26 @@
|
|||||||
{{#if linkHref}}
|
{{#if linkHref}}
|
||||||
<a href='{{linkHref}}'>
|
<a href='{{linkHref}}'>
|
||||||
{{#if thumbnailUrl}}
|
{{#if thumbnailUrl}}
|
||||||
<img src='{{thumbnailUrl}}' alt='{{productTitle}} — {{variantTitle}}' />
|
{{> storefront-image
|
||||||
|
src=thumbnailUrl
|
||||||
|
alt=''
|
||||||
|
width='1'
|
||||||
|
height='1'
|
||||||
|
loading='lazy'
|
||||||
|
}}
|
||||||
{{else}}
|
{{else}}
|
||||||
<span class='sf-thumb__placeholder'>no image</span>
|
<span class='sf-thumb__placeholder'>no image</span>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</a>
|
</a>
|
||||||
{{else}}
|
{{else}}
|
||||||
{{#if thumbnailUrl}}
|
{{#if thumbnailUrl}}
|
||||||
<img src='{{thumbnailUrl}}' alt='{{productTitle}} — {{variantTitle}}' />
|
{{> storefront-image
|
||||||
|
src=thumbnailUrl
|
||||||
|
alt=''
|
||||||
|
width='1'
|
||||||
|
height='1'
|
||||||
|
loading='lazy'
|
||||||
|
}}
|
||||||
{{else}}
|
{{else}}
|
||||||
<span class='sf-thumb__placeholder'>no image</span>
|
<span class='sf-thumb__placeholder'>no image</span>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|||||||
@@ -2,11 +2,14 @@
|
|||||||
{{#with selectedVariant}}
|
{{#with selectedVariant}}
|
||||||
{{#if thumbnailUrl}}
|
{{#if thumbnailUrl}}
|
||||||
<a class='sf-product-card__media-link' href='{{detailHref}}'>
|
<a class='sf-product-card__media-link' href='{{detailHref}}'>
|
||||||
<img
|
{{> storefront-image
|
||||||
class='sf-product-card__image'
|
class='sf-product-card__image'
|
||||||
src='{{thumbnailUrl}}'
|
src=thumbnailUrl
|
||||||
alt='{{productTitle}} - {{title}}'
|
alt=''
|
||||||
/>
|
width='1'
|
||||||
|
height='1'
|
||||||
|
loading='lazy'
|
||||||
|
}}
|
||||||
</a>
|
</a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/with}}
|
{{/with}}
|
||||||
|
|||||||
@@ -3,7 +3,13 @@
|
|||||||
<div class='sf-header__brand-group'>
|
<div class='sf-header__brand-group'>
|
||||||
{{#if logoUrl}}
|
{{#if logoUrl}}
|
||||||
<a class='sf-logo-link' href='/'>
|
<a class='sf-logo-link' href='/'>
|
||||||
<img class='sf-logo' src='{{logoUrl}}' alt='{{shopName}}' />
|
{{> storefront-image
|
||||||
|
class='sf-logo'
|
||||||
|
src=logoUrl
|
||||||
|
alt=shopName
|
||||||
|
width='200'
|
||||||
|
height='50'
|
||||||
|
}}
|
||||||
</a>
|
</a>
|
||||||
{{else}}
|
{{else}}
|
||||||
<a class='sf-logo-link' href='/'>{{shopName}}</a>
|
<a class='sf-logo-link' href='/'>{{shopName}}</a>
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<img
|
||||||
|
class='{{class}}'
|
||||||
|
src='{{src}}'
|
||||||
|
alt='{{alt}}'
|
||||||
|
width='{{width}}'
|
||||||
|
height='{{height}}'
|
||||||
|
decoding='async'
|
||||||
|
{{#if loading}}loading='{{loading}}'{{/if}}
|
||||||
|
{{#if fetchPriority}}fetchpriority='{{fetchPriority}}'{{/if}}
|
||||||
|
/>
|
||||||
@@ -1,10 +1,13 @@
|
|||||||
{{#if selectedImageUrl}}
|
{{#if selectedImageUrl}}
|
||||||
<div class='sf-product-gallery'>
|
<div class='sf-product-gallery'>
|
||||||
<img
|
{{> storefront-image
|
||||||
class='sf-product-gallery__main'
|
class='sf-product-gallery__main'
|
||||||
src='{{selectedImageUrl}}'
|
src=selectedImageUrl
|
||||||
alt='{{productTitle}}'
|
alt=productTitle
|
||||||
/>
|
width='1'
|
||||||
|
height='1'
|
||||||
|
fetchPriority='high'
|
||||||
|
}}
|
||||||
|
|
||||||
{{#if galleryImages}}
|
{{#if galleryImages}}
|
||||||
{{#if (gt galleryImages.length 1)}}
|
{{#if (gt galleryImages.length 1)}}
|
||||||
@@ -15,7 +18,13 @@
|
|||||||
class='sf-variant-link sf-variant-link--sm{{#if isSelected}} sf-variant-link--selected{{/if}}'
|
class='sf-variant-link sf-variant-link--sm{{#if isSelected}} sf-variant-link--selected{{/if}}'
|
||||||
{{#if isSelected}}aria-current='page'{{/if}}
|
{{#if isSelected}}aria-current='page'{{/if}}
|
||||||
>
|
>
|
||||||
<img src='{{url}}' alt='' />
|
{{> storefront-image
|
||||||
|
src=url
|
||||||
|
alt=''
|
||||||
|
width='1'
|
||||||
|
height='1'
|
||||||
|
loading='lazy'
|
||||||
|
}}
|
||||||
</a>
|
</a>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -6,7 +6,13 @@
|
|||||||
{{#if size}}style='width:{{size}}px;height:{{size}}px;aspect-ratio:auto;'{{/if}}
|
{{#if size}}style='width:{{size}}px;height:{{size}}px;aspect-ratio:auto;'{{/if}}
|
||||||
>
|
>
|
||||||
{{#if thumbnailUrl}}
|
{{#if thumbnailUrl}}
|
||||||
<img src='{{thumbnailUrl}}' alt='{{#if title}}{{title}}{{else}}Variant{{/if}}' />
|
{{> storefront-image
|
||||||
|
src=thumbnailUrl
|
||||||
|
alt=''
|
||||||
|
width='1'
|
||||||
|
height='1'
|
||||||
|
loading='lazy'
|
||||||
|
}}
|
||||||
{{else}}
|
{{else}}
|
||||||
<span class='sf-thumb__placeholder'>no image</span>
|
<span class='sf-thumb__placeholder'>no image</span>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|||||||
Reference in New Issue
Block a user