Raw
1 import { HttpTypes } from "@medusajs/types"
2 import { UIMatch } from "react-router-dom"
3 import { useCollection } from "../../../hooks/api"
4
5 type CollectionDetailBreadcrumbProps =
6 UIMatch<HttpTypes.AdminCollectionResponse>
7
8 export const CollectionDetailBreadcrumb = (
9 props: CollectionDetailBreadcrumbProps
10 ) => {
11 const { id } = props.params || {}
12
13 const { collection } = useCollection(id!, {
14 initialData: props.loaderData,
15 enabled: Boolean(id),
16 })
17
18 if (!collection) {
19 return null
20 }
21
22 return <span>{collection.title}</span>
23 }
24
25 export const seo = (match: UIMatch<HttpTypes.AdminCollectionResponse>) => ({
26 title: match.loaderData?.collection?.title,
27 })