@visns-studio/visns-components 4.9.0 → 4.9.1
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/package.json
CHANGED
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"react-dom": "^17.0.0 || ^18.0.0"
|
|
76
76
|
},
|
|
77
77
|
"name": "@visns-studio/visns-components",
|
|
78
|
-
"version": "4.9.
|
|
78
|
+
"version": "4.9.1",
|
|
79
79
|
"description": "Various packages to assist in the development of our Custom Applications.",
|
|
80
80
|
"main": "src/index.js",
|
|
81
81
|
"files": [
|
|
@@ -3,9 +3,17 @@ import { Link } from 'react-router-dom';
|
|
|
3
3
|
import { CircleChevronRight } from 'akar-icons';
|
|
4
4
|
|
|
5
5
|
function Breadcrumb({ data, page }) {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
// Function to get nested data, handling array of keys
|
|
7
|
+
const getNestedData = (data, keys) => {
|
|
8
|
+
return Array.isArray(keys)
|
|
9
|
+
? keys.reduce(
|
|
10
|
+
(acc, key) => (acc && acc[key] ? acc[key] : null),
|
|
11
|
+
data
|
|
12
|
+
)
|
|
13
|
+
: data[keys];
|
|
14
|
+
};
|
|
8
15
|
|
|
16
|
+
// Get the nested data for parent title key if it exists
|
|
9
17
|
const nestedData =
|
|
10
18
|
data && page.parentTitleKey
|
|
11
19
|
? getNestedData(data, page.parentTitleKey)
|
|
@@ -42,8 +50,21 @@ function Breadcrumb({ data, page }) {
|
|
|
42
50
|
)
|
|
43
51
|
)}
|
|
44
52
|
|
|
45
|
-
{page.titleKey && data &&
|
|
46
|
-
<>
|
|
53
|
+
{page.titleKey && data && (
|
|
54
|
+
<>
|
|
55
|
+
{Array.isArray(page.titleKey) ? (
|
|
56
|
+
// If titleKey is an array, iterate and display each nested value
|
|
57
|
+
page.titleKey.map((key, index) => (
|
|
58
|
+
<span key={index}>
|
|
59
|
+
{data[key]}
|
|
60
|
+
{index < page.titleKey.length - 1 && ' '}
|
|
61
|
+
</span>
|
|
62
|
+
))
|
|
63
|
+
) : (
|
|
64
|
+
// If titleKey is a single string, display the corresponding data
|
|
65
|
+
<>{data[page.titleKey]}</>
|
|
66
|
+
)}
|
|
67
|
+
</>
|
|
47
68
|
)}
|
|
48
69
|
</h1>
|
|
49
70
|
);
|