forked from crowetic/commerce
Removes priority on third grid item on home page (#1143)
This commit is contained in:
parent
80bb15a7dc
commit
9044baf44e
@ -3,7 +3,15 @@ import { getCollectionProducts } from 'lib/shopify';
|
|||||||
import type { Product } from 'lib/shopify/types';
|
import type { Product } from 'lib/shopify/types';
|
||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
|
|
||||||
function ThreeItemGridItem({ item, size }: { item: Product; size: 'full' | 'half' }) {
|
function ThreeItemGridItem({
|
||||||
|
item,
|
||||||
|
size,
|
||||||
|
priority
|
||||||
|
}: {
|
||||||
|
item: Product;
|
||||||
|
size: 'full' | 'half';
|
||||||
|
priority?: boolean;
|
||||||
|
}) {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={size === 'full' ? 'md:col-span-4 md:row-span-2' : 'md:col-span-2 md:row-span-1'}
|
className={size === 'full' ? 'md:col-span-4 md:row-span-2' : 'md:col-span-2 md:row-span-1'}
|
||||||
@ -15,7 +23,7 @@ function ThreeItemGridItem({ item, size }: { item: Product; size: 'full' | 'half
|
|||||||
sizes={
|
sizes={
|
||||||
size === 'full' ? '(min-width: 768px) 66vw, 100vw' : '(min-width: 768px) 33vw, 100vw'
|
size === 'full' ? '(min-width: 768px) 66vw, 100vw' : '(min-width: 768px) 33vw, 100vw'
|
||||||
}
|
}
|
||||||
priority={true}
|
priority={priority}
|
||||||
alt={item.title}
|
alt={item.title}
|
||||||
label={{
|
label={{
|
||||||
position: size === 'full' ? 'center' : 'bottom',
|
position: size === 'full' ? 'center' : 'bottom',
|
||||||
@ -41,8 +49,8 @@ export async function ThreeItemGrid() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<section className="mx-auto grid max-w-screen-2xl gap-4 px-4 pb-4 md:grid-cols-6 md:grid-rows-2">
|
<section className="mx-auto grid max-w-screen-2xl gap-4 px-4 pb-4 md:grid-cols-6 md:grid-rows-2">
|
||||||
<ThreeItemGridItem size="full" item={firstProduct} />
|
<ThreeItemGridItem size="full" item={firstProduct} priority={true} />
|
||||||
<ThreeItemGridItem size="half" item={secondProduct} />
|
<ThreeItemGridItem size="half" item={secondProduct} priority={true} />
|
||||||
<ThreeItemGridItem size="half" item={thirdProduct} />
|
<ThreeItemGridItem size="half" item={thirdProduct} />
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user