Skip to content

Commit

Permalink
Adding image decoding (#642)
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelstz committed Mar 13, 2023
1 parent 1421108 commit ead686e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/lazy-books-attend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/create-hydrogen': patch
---

Adding decoding prop to the SpreadMedia component
3 changes: 3 additions & 0 deletions templates/demo-store/app/components/Hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export function Hero({
interface SpreadMediaProps {
data: Media | MediaImage | MediaVideo;
loading?: HTMLImageElement['loading'];
decoding?: HTMLImageElement['decoding'];
scale?: 2 | 3;
sizes: string;
width: number;
Expand All @@ -97,6 +98,7 @@ interface SpreadMediaProps {
function SpreadMedia({
data,
loading,
decoding,
scale,
sizes,
width,
Expand All @@ -118,6 +120,7 @@ function SpreadMedia({
},
image: {
loading,
decoding,
loaderOptions: {scale, crop: 'center'},
widths,
sizes,
Expand Down
1 change: 1 addition & 0 deletions templates/demo-store/app/lib/placeholders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const PLACEHOLDERS = {
},
height: 'full',
top: true,
decoding: 'sync',
loading: 'eager',
},
// secondaryHero
Expand Down

0 comments on commit ead686e

Please sign in to comment.