gbs-add-block 0.0.64 → 0.0.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/index.js +1 -0
- package/package.json +1 -1
- package/source/components/breadcrumb/index.tsx +64 -0
- package/source/components/breadcrumb/types.ts +10 -0
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# GBS Building Blocks 2.0 (v0.0.
|
|
1
|
+
# GBS Building Blocks 2.0 (v0.0.65)
|
|
2
2
|
|
|
3
3
|
Latest and upgraded version of GBS building blocks with headless UI and removed dependencies.
|
|
4
4
|
|
|
@@ -6,10 +6,10 @@ Latest and upgraded version of GBS building blocks with headless UI and removed
|
|
|
6
6
|
|
|
7
7
|
For detailed documentation on usage and props, Please visit: [Building Block Documentation v2.0](https://blackmax-designs.gitbook.io/building-block-v2.0)
|
|
8
8
|
|
|
9
|
-
## What's New 🎉 (Ver 0.0.
|
|
9
|
+
## What's New 🎉 (Ver 0.0.65)
|
|
10
10
|
|
|
11
11
|
- Updated for bug fixes.
|
|
12
|
-
- New component "Skeleton" & "Navbar" Added.
|
|
12
|
+
- New component "Skeleton", "Breadcrumb" & "Navbar" Added.
|
|
13
13
|
- Planned Deprecation of Current Grid Component and Adding Beta version for the New Data Grid.
|
|
14
14
|
|
|
15
15
|
## Authors
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Grampro Business Services and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from "react";
|
|
9
|
+
import { useLocation } from "@grampro/headless-helpers";
|
|
10
|
+
import Icon from "../icon/Icon";
|
|
11
|
+
import { rightArrow } from "../icon/iconPaths";
|
|
12
|
+
import { BreadcrumbsProps } from "./types";
|
|
13
|
+
|
|
14
|
+
export const Breadcrumb = ({
|
|
15
|
+
showHome = true,
|
|
16
|
+
rootPath = "/",
|
|
17
|
+
homeLabel = "Home",
|
|
18
|
+
transformLabel,
|
|
19
|
+
className = "",
|
|
20
|
+
activeLinkClass = "font-medium text-gray-900 dark:text-white",
|
|
21
|
+
inactiveLinkClass = "text-gray-500 hover:text-gray-700",
|
|
22
|
+
}: BreadcrumbsProps) => {
|
|
23
|
+
const { pathSegments } = useLocation({
|
|
24
|
+
showHome,
|
|
25
|
+
rootPath,
|
|
26
|
+
homeLabel,
|
|
27
|
+
transformLabel,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
if (pathSegments.length === 0) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<nav aria-label="Breadcrumb" className={className}>
|
|
36
|
+
<ol className="flex flex-wrap items-center">
|
|
37
|
+
{pathSegments.map((segment, index) => {
|
|
38
|
+
const isLast = index === pathSegments.length - 1;
|
|
39
|
+
return (
|
|
40
|
+
<li key={index} className="flex items-center">
|
|
41
|
+
<>
|
|
42
|
+
<a
|
|
43
|
+
href={segment.path}
|
|
44
|
+
className={isLast ? activeLinkClass : inactiveLinkClass}
|
|
45
|
+
>
|
|
46
|
+
{segment.label}
|
|
47
|
+
</a>
|
|
48
|
+
<span className="mx-2 text-gray-400">
|
|
49
|
+
<Icon
|
|
50
|
+
elements={rightArrow}
|
|
51
|
+
dimensions={{ width: 14, height: 14 }}
|
|
52
|
+
svgClass={
|
|
53
|
+
"stroke-black fill-none dark:stroke-white cursor-pointer"
|
|
54
|
+
}
|
|
55
|
+
/>
|
|
56
|
+
</span>
|
|
57
|
+
</>
|
|
58
|
+
</li>
|
|
59
|
+
);
|
|
60
|
+
})}
|
|
61
|
+
</ol>
|
|
62
|
+
</nav>
|
|
63
|
+
);
|
|
64
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type BreadcrumbsProps = {
|
|
2
|
+
homeLabel?: string;
|
|
3
|
+
showHome?: boolean;
|
|
4
|
+
transformLabel?: (segment: string) => string;
|
|
5
|
+
rootPath?: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
separator?: string | React.ReactNode;
|
|
8
|
+
activeLinkClass?: string;
|
|
9
|
+
inactiveLinkClass?: string;
|
|
10
|
+
};
|