Skip to content

Commit f47f7c9

Browse files
committed
feat: add breadcrumb bars in storybook
1 parent c703f69 commit f47f7c9

File tree

3 files changed

+69
-5
lines changed

3 files changed

+69
-5
lines changed

src/components/AppBar/AppBar.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,9 @@ import React from 'react';
55
import PropTypes from 'prop-types';
66
import { Button, AppBar as MuiAppBar, Toolbar } from '@mui/material';
77
import { StatusBar } from '../';
8-
import { useCurrentSimulationRunner } from '../../state/runner/hooks';
98
import { ThemeSwitch } from './components';
109

11-
export const AppBar = ({ children }) => {
12-
const currentScenario = useCurrentSimulationRunner();
13-
10+
export const AppBar = ({ children, currentScenario }) => {
1411
return (
1512
<MuiAppBar
1613
position="sticky"
@@ -44,4 +41,5 @@ export const AppBar = ({ children }) => {
4441
};
4542
AppBar.propTypes = {
4643
children: PropTypes.node,
44+
currentScenario: PropTypes.object,
4745
};

src/layouts/TabLayout/TabLayout.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export const TabLayout = () => {
5252
);
5353

5454
const BreadcrumbBar = () => (
55-
<AppBar>
55+
<AppBar currentScenario={currentScenario}>
5656
{currentWorkspace.data ? (
5757
<Fragment>
5858
<MuiLink underline="hover" color="inherit" href={`/${currentWorkspace?.data?.id}`}>
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/* eslint-disable react/prop-types */
2+
import { CircleArrowRight } from 'lucide-react';
3+
import React, { Fragment } from 'react';
4+
import { Link as MuiLink, Typography } from '@mui/material';
5+
import { AppBar } from '../../../components/AppBar';
6+
7+
export default {
8+
title: 'Molecule/Breadcrumb Bar',
9+
component: AppBar,
10+
parameters: {
11+
layout: 'fullscreen',
12+
},
13+
};
14+
15+
const MockBreadcrumb = ({ workspaceName, scenarioName }) => (
16+
<Fragment>
17+
<MuiLink underline="hover" color="inherit" href="#">
18+
<Typography fontSize={14}>{workspaceName}</Typography>
19+
</MuiLink>
20+
21+
{scenarioName && (
22+
<Fragment>
23+
<CircleArrowRight size={14} />
24+
<MuiLink underline="hover" color="inherit" href="#">
25+
<Typography fontSize={14}>Scenarios</Typography>
26+
</MuiLink>
27+
</Fragment>
28+
)}
29+
30+
{scenarioName && (
31+
<>
32+
<CircleArrowRight size={14} />
33+
<MuiLink underline="hover" color="inherit" href="#">
34+
<Typography fontSize={14}>{scenarioName}</Typography>
35+
</MuiLink>
36+
</>
37+
)}
38+
</Fragment>
39+
);
40+
41+
const Template = (args) => (
42+
<AppBar currentScenario={args.currentScenario}>
43+
<MockBreadcrumb {...args} />
44+
</AppBar>
45+
);
46+
47+
export const Default = Template.bind({});
48+
Default.args = {
49+
workspaceName: 'Logistics Optimization',
50+
scenarioName: 'Baseline Scenario',
51+
currentScenario: { data: { name: 'Baseline Scenario' } },
52+
};
53+
54+
export const WorkspaceOnly = Template.bind({});
55+
WorkspaceOnly.args = {
56+
workspaceName: 'Asset Aip Workspaces',
57+
scenarioName: null,
58+
currentScenario: null,
59+
};
60+
61+
export const LongNames = Template.bind({});
62+
LongNames.args = {
63+
workspaceName: 'Very Long Workspace Name To Test UI Layout',
64+
scenarioName: 'Extremely Detailed Scenario',
65+
currentScenario: { data: { name: 'Extremely Detailed Scenario Title Mock For Visual Testing Purposes' } },
66+
};

0 commit comments

Comments
 (0)