Gennadysht пре 1 година
родитељ
комит
196bebe4e1
2 измењених фајлова са 40 додато и 0 уклоњено
  1. 35 0
      src/Components/CategoryBreadcrumbs.js
  2. 5 0
      src/Components/LoadingState.js

+ 35 - 0
src/Components/CategoryBreadcrumbs.js

@@ -0,0 +1,35 @@
+import { Breadcrumbs } from "@mui/material";
+import { Typography } from "@mui/material";
+import { MyLink } from ".";
+
+export const CategoryBreadcrumbs = ({ category, showLeafAsLink = false }) => {
+    return (
+        <Breadcrumbs aria-label="breadcrumb">
+            <MyLink underline="hover" color="inherit" to="/">
+                Home
+            </MyLink>
+            {
+                category.parent?._id && (
+                    <MyLink
+                        underline="hover"
+                        color="inherit"
+                        to={`/category/${category.parent?._id}`}
+                    >
+                        {category.parent?.name}
+                    </MyLink>
+                )}
+            {
+                showLeafAsLink ?
+                        <MyLink
+                            underline="hover"
+                            color="inherit"
+                            to={`/category/${category._id}`}
+                        >
+                            {category.name}
+                        </MyLink>
+                    :
+                    <Typography color="text.primary">{category.name}</Typography>
+            }
+        </Breadcrumbs>
+    );
+};

+ 5 - 0
src/Components/LoadingState.js

@@ -0,0 +1,5 @@
+import { Typography } from "@mui/material";
+
+export const LoadingState = () =>{
+    return <Typography>Loading</Typography>;
+}