mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
## Description This PR ensures that the default prettier config is used for examples and templates. This config is compatible with `prettier@3` as well (upgrading prettier is bigger change that can be a future PR). ## Changes - Updated `.prettierrc.json` in root with `"trailingComma": "es5"` (will be needed upgrading to prettier@3) - Added `examples/.prettierrc.json` with default config (this will change every example) - Added `packages/create-next-app/templates/.prettierrc.json` with default config (this will change every template) ## Related - Fixes #54402 - Closes #54409
52 lines
1.4 KiB
TypeScript
52 lines
1.4 KiB
TypeScript
import { useRef } from "react";
|
|
import Header from "../components/Header";
|
|
import ProductCard from "../components/ProductCard";
|
|
import getProducts from "../sfcc.js";
|
|
|
|
export default function Gallery({ data }) {
|
|
let coffeeRef = useRef<HTMLParagraphElement>();
|
|
|
|
const scrollHandler = (e) => {
|
|
e.preventDefault();
|
|
// @ts-ignore
|
|
coffeeRef.scrollIntoView({
|
|
behavior: "smooth",
|
|
block: "start",
|
|
});
|
|
};
|
|
|
|
return (
|
|
<>
|
|
<Header scrollHandler={scrollHandler} />
|
|
<div className="mx-auto max-w-2xl px-4 sm:px-6 lg:max-w-7xl lg:px-8">
|
|
<div className="sm:py-15 mx-auto max-w-7xl py-16 px-4 sm:px-6 lg:px-8">
|
|
<div className="text-center">
|
|
<p
|
|
className="mt-1 text-4xl font-bold uppercase text-gray-900 sm:text-5xl sm:tracking-tight lg:text-5xl"
|
|
ref={coffeeRef}
|
|
>
|
|
Crafted by us, for you
|
|
</p>
|
|
</div>
|
|
</div>
|
|
<div className="grid grid-cols-1 gap-y-10 gap-x-6 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 xl:gap-x-8">
|
|
{data &&
|
|
data.map((product) => (
|
|
<ProductCard product={product} key={product.id} />
|
|
))}
|
|
</div>
|
|
</div>
|
|
</>
|
|
);
|
|
}
|
|
|
|
export async function getStaticProps() {
|
|
const searchResults = await getProducts("coffee");
|
|
|
|
return {
|
|
props: {
|
|
data: searchResults,
|
|
},
|
|
};
|
|
}
|