fix keys warning

This commit is contained in:
Sol Irvine 2023-08-21 10:17:35 +09:00
parent 3e510b1469
commit 1d156e6e64
3 changed files with 6 additions and 6 deletions

View File

@ -6,8 +6,8 @@ import Link from 'next/link';
export default function ProductGridItems({ products }: { products: Product[] }) {
return (
<>
{products.map((product) => (
<Grid.Item key={product.handle} className="animate-fadeIn">
{products.map((product, index) => (
<Grid.Item key={`${product.handle}-${index}`} className="animate-fadeIn">
<Link className="relative inline-block h-full w-full" href={`/product/${product.handle}`}>
<GridTileImage
alt={product.title}

View File

@ -34,8 +34,8 @@ export default async function StoriesDetail({
'flex flex-col space-y-6 md:space-y-px'
)}
>
{blog?.articles?.map((article) => (
<Link href={`/stories/${article.handle}`}>
{blog?.articles?.map((article, index) => (
<Link href={`/stories/${article.handle}`} key={`${article.handle}-${index}`}>
<div className="flex flex-col space-y-2 bg-white text-black md:col-span-1 md:flex-row md:space-x-2 md:space-y-0">
<div className="relative aspect-[4/3] min-w-full overflow-hidden md:min-w-[480px]">
{!!article?.image?.url && (

View File

@ -33,8 +33,8 @@ export default async function Stories({
'grid grid-cols-1 gap-y-24 md:grid-cols-3 md:gap-x-4'
)}
>
{blog?.articles?.map((article) => (
<Link href={`/stories/${article.handle}`}>
{blog?.articles?.map((article, index) => (
<Link href={`/stories/${article.handle}`} key={`${article.handle}-${index}`}>
<div className="flex flex-col space-y-4 md:col-span-1">
<div className="relative aspect-square overflow-hidden md:max-w-sm">
{!!article?.image?.url && (