-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename ProductCard to ProductGridItem
- Loading branch information
Showing
11 changed files
with
240 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
apps/store/src/blocks/ProductGridItemBlock/ProductGridItemBlock.helpers.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { type useProductMetadata } from '@/components/LayoutWithMenu/productMetadataHooks' | ||
import { isSameLink } from '@/utils/url' | ||
|
||
|
||
export type LinkType = 'product' | 'category' | ||
|
||
export const getLinkType = ( | ||
productMetadata: ReturnType<typeof useProductMetadata> = [], | ||
link: string, | ||
): LinkType | 'content' => { | ||
const isProductLink = productMetadata?.some((product) => isSameLink(link, product.pageLink)) | ||
if (isProductLink) { | ||
return 'product' | ||
} | ||
|
||
const isCategoryLink = productMetadata?.some( | ||
(product) => product.categoryPageLink && isSameLink(link, product.categoryPageLink), | ||
) | ||
if (isCategoryLink) { | ||
return 'category' | ||
} | ||
|
||
return 'content' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.