4
0
forked from crowetic/commerce

Img Sizes

This commit is contained in:
Belen Curcio 2020-11-05 18:59:22 -03:00
parent 3b5ac2df1f
commit c419c3f361
4 changed files with 7 additions and 2 deletions

View File

@ -14,6 +14,7 @@ interface Props {
imgWidth: number | string imgWidth: number | string
imgHeight: number | string imgHeight: number | string
priority?: boolean priority?: boolean
imgLayout?: 'fixed' | 'intrinsic' | 'responsive' | undefined
} }
const ProductCard: FC<Props> = ({ const ProductCard: FC<Props> = ({
@ -22,6 +23,7 @@ const ProductCard: FC<Props> = ({
variant, variant,
imgWidth, imgWidth,
imgHeight, imgHeight,
imgLayout = 'responsive',
priority, priority,
}) => { }) => {
const src = p.images.edges?.[0]?.node?.urlOriginal! const src = p.images.edges?.[0]?.node?.urlOriginal!
@ -50,6 +52,7 @@ const ProductCard: FC<Props> = ({
height={imgHeight} height={imgHeight}
priority={priority} priority={priority}
quality="85" quality="85"
layout={imgLayout}
/> />
</div> </div>
) : ( ) : (

View File

@ -8,7 +8,7 @@
& > * { & > * {
@apply flex-1 px-16 py-4; @apply flex-1 px-16 py-4;
width: 450px; width: 430px;
} }
} }

View File

@ -1,6 +1,6 @@
module.exports = { module.exports = {
images: { images: {
sizes: [320, 480, 820, 1200, 1600], imagesSizes: [320, 480, 820, 1200, 1600],
domains: ['cdn11.bigcommerce.com'], domains: ['cdn11.bigcommerce.com'],
}, },
i18n: { i18n: {

View File

@ -97,6 +97,7 @@ export default function Home({
variant="slim" variant="slim"
imgWidth={320} imgWidth={320}
imgHeight={320} imgHeight={320}
imgLayout="fixed"
/> />
))} ))}
</Marquee> </Marquee>
@ -129,6 +130,7 @@ export default function Home({
variant="slim" variant="slim"
imgWidth={320} imgWidth={320}
imgHeight={320} imgHeight={320}
imgLayout="fixed"
/> />
))} ))}
</Marquee> </Marquee>