ソースを参照

rtk_bug_fix_css

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>;
+}