@vrobots/storybook 0.1.59 → 0.1.60
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/dist/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import { HStack,
|
|
3
|
+
import { HStack, Text } from "@chakra-ui/react";
|
|
4
4
|
export const Breadcrumbs = React.forwardRef(({ breadcrumbs }, ref) => {
|
|
5
5
|
if (!!breadcrumbs) {
|
|
6
|
-
const crumbs = breadcrumbs.map(({ title, nav, color: itemColor }, key) => {
|
|
6
|
+
const crumbs = breadcrumbs.map(({ title, nav, color: itemColor, onClick }, key) => {
|
|
7
7
|
if (!!nav) {
|
|
8
|
-
return (_jsxs(HStack, { children: [_jsx(
|
|
8
|
+
return (_jsxs(HStack, { children: [_jsx(Text, { as: 'button', color: itemColor || 'blue.500', whiteSpace: 'nowrap', wordBreak: 'break-word', fontSize: 'sm', truncate: true, onClick: () => onClick(nav), children: title }), _jsx(Text, { ml: 2, mr: 2, fontSize: 'sm', children: ">" })] }, `${title}-${key}`));
|
|
9
9
|
}
|
|
10
10
|
return (_jsx(Text, { whiteSpace: 'nowrap', wordBreak: 'break-word', color: 'gray.500', fontSize: 'sm', truncate: true, children: title }, `${title}-${key}`));
|
|
11
11
|
});
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { Breadcrumbs } from '../components/Breadcrumbs';
|
|
2
|
+
const onClick = (nav) => {
|
|
3
|
+
console.log('Breadcrumb clicked:', nav);
|
|
4
|
+
};
|
|
2
5
|
export const EXAMPLE_BREADCRUMBS = [
|
|
3
|
-
{ title: 'Home', nav: '/' },
|
|
4
|
-
{ title: 'Products', nav: '/products' },
|
|
5
|
-
{ title: 'Electronics', nav: '/products/electronics' },
|
|
6
|
-
{ title: 'Laptops', nav: '/products/electronics/laptops' },
|
|
7
|
-
{ title: 'Gaming Laptops' },
|
|
6
|
+
{ title: 'Home', nav: '/', onClick },
|
|
7
|
+
{ title: 'Products', nav: '/products', onClick },
|
|
8
|
+
{ title: 'Electronics', nav: '/products/electronics', onClick },
|
|
9
|
+
{ title: 'Laptops', nav: '/products/electronics/laptops', onClick },
|
|
10
|
+
{ title: 'Gaming Laptops', onClick },
|
|
8
11
|
];
|
|
9
12
|
const meta = {
|
|
10
13
|
title: 'Navigation/Breadcrumbs',
|
|
@@ -17,6 +20,6 @@ const meta = {
|
|
|
17
20
|
export default meta;
|
|
18
21
|
export const Component = {
|
|
19
22
|
args: {
|
|
20
|
-
breadcrumbs: EXAMPLE_BREADCRUMBS
|
|
23
|
+
breadcrumbs: EXAMPLE_BREADCRUMBS,
|
|
21
24
|
}
|
|
22
25
|
};
|