Skip to content

Commit

Permalink
fix: link (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
emersonlaurentino authored Aug 20, 2021
1 parent eb2659c commit b545f98
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/components/product/ProductSummary/ProductSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ function ProductSummary({ product, variant = 'simple' }: Props) {

const Wrapper = product?.linkText
? ({ children }: PropsWithChildren<unknown>) => (
<Link to={product?.linkText ?? ''}>{children}</Link>
<Link to={`/${product?.linkText}/p` ?? ''}>{children}</Link>
)
: Fragment

Expand Down
12 changes: 8 additions & 4 deletions src/components/sections/ProductGallery/ProductGallery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ function ProductGallery({ initialData, productSearch: { totalCount } }: Props) {
} = useSearch()

return (
<>
<div className="flex flex-col items-center">
{/* Controls */}
<div>Total Products: {totalCount}</div>

{/* Add link to previous page. This helps on SEO */}
{prev !== false && (
Expand All @@ -46,15 +45,20 @@ function ProductGallery({ initialData, productSearch: { totalCount } }: Props) {

{/* Add link to next page. This helps on SEO */}
{next !== false && (
<a onClick={setNextPage} href={next.link} rel="next">
<a
onClick={setNextPage}
className="bg-primary text-white px-4 py-2 rounded-md mt-4"
href={next.link}
rel="next"
>
Show More
</a>
)}

{/* Prefetch Previous and Next pages */}
{prev !== false && <GalleryPage page={prev.cursor} display={false} />}
{next !== false && <GalleryPage page={next.cursor} display={false} />}
</>
</div>
)
}

Expand Down

0 comments on commit b545f98

Please sign in to comment.