diff --git a/src/components/common/BreadcrumbCommon/BreadcrumbCommon.tsx b/src/components/common/BreadcrumbCommon/BreadcrumbCommon.tsx
index 8b36f7e50..615a26893 100644
--- a/src/components/common/BreadcrumbCommon/BreadcrumbCommon.tsx
+++ b/src/components/common/BreadcrumbCommon/BreadcrumbCommon.tsx
@@ -1,54 +1,43 @@
import React from 'react'
import s from './BreadcrumbCommon.module.scss'
-import { useRouter } from 'next/router'
-
import BreadcrumbItem from './components/BreadcrumbItem/BreadcrumbItem'
import BreadcrumbSeparator from './components/BreadcrumbSeparator/BreadcrumbSeparator'
-const BreadcrumbCommon = () => {
+interface BreadcrumbCommonProps {
+ crumbs: { link:string, name:string }[];
+ showHomePage?: boolean;
+}
- const paths: string | any = {
- "/": "Home",
- "fresh-product-today" : "Fresh Product Today",
- "product-list": "Product List",
- "recipes-list": "Recipes List",
- "blogs": "Blog",
- "account": "Account",
- "delivery&policy": "Delivery & Policy",
- "product-detail": "Product Detail",
- "recipes-detail": "Recipes Detail",
- "blog-detail": "Blog Detail"
+const BreadcrumbCommon = ({ crumbs, showHomePage=true } : BreadcrumbCommonProps) => {
+ if (showHomePage) {
+ crumbs.unshift({link: "/", name: "Home"});
}
-
- const router = useRouter();
- let crumbs = router.route.split('/');
-
return (
-
{
crumbs.map((crumb, i) => {
- if (crumb === "") {
- return
+ if (i === 0) {
+ return (
+
+ )
}
if (i === crumbs.length-1) {
return (
-
+
)
}
return (
-
+
)
})
}
)
-
}
export default BreadcrumbCommon
diff --git a/src/components/common/BreadcrumbCommon/components/BreadcrumbItem/BreadcrumbItem.tsx b/src/components/common/BreadcrumbCommon/components/BreadcrumbItem/BreadcrumbItem.tsx
index 9a501c93f..f807de555 100644
--- a/src/components/common/BreadcrumbCommon/components/BreadcrumbItem/BreadcrumbItem.tsx
+++ b/src/components/common/BreadcrumbCommon/components/BreadcrumbItem/BreadcrumbItem.tsx
@@ -8,8 +8,8 @@ interface BreadcrumbItemProps {
const BreadcrumbItem = ({ text, href }: BreadcrumbItemProps) => {
return (
-
- {text}
+
+ {text}
)
}
diff --git a/src/components/common/BreadcrumbCommon/components/BreadcrumbSeparator/BreadcrumbSeparator.tsx b/src/components/common/BreadcrumbCommon/components/BreadcrumbSeparator/BreadcrumbSeparator.tsx
index c877e60bc..370c342d8 100644
--- a/src/components/common/BreadcrumbCommon/components/BreadcrumbSeparator/BreadcrumbSeparator.tsx
+++ b/src/components/common/BreadcrumbCommon/components/BreadcrumbSeparator/BreadcrumbSeparator.tsx
@@ -1,7 +1,7 @@
import React from 'react'
interface BreadcrumbSeparatorProps {
- children: any;
+ children?: React.ReactNode
}
const BreadcrumbSeparator = ({ children }: BreadcrumbSeparatorProps) => {