Skip to content

Commit a49eacb

Browse files
authored
bug(global navigation): fix storybook examples, update to new syntax (#4702)
1 parent 340add7 commit a49eacb

File tree

4 files changed

+94
-78
lines changed

4 files changed

+94
-78
lines changed

ui/components/global-navigation/docs.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import Blockquote from '../../../shared/components/Blockquote';
44
import { NavBarItem } from './navigation-bar/';
55
import * as NavExamples from './navigation-bar/example';
66
import * as NavTabBarExamples from './navigation-tab-bar/example';
7-
import { getDisplayElementById } from '../../shared/helpers';
7+
import { getDisplayElementById, getDemoStylesById } from '../../shared/helpers';
88

99
<div className="doc lead">
1010
Global Navigation is the list of navigation links your users find in the Header on every page in Salesforce. Your Global Navigation includes a Navigation Bar where your users find the App Launcher, App Name, and Pages that each App includes.
1111
</div>
1212

13-
<CodeView exampleOnly demoStyles="height: 15rem;">
13+
<CodeView exampleOnly demoStyles={getDemoStylesById(NavExamples.default, 'default')}>
1414
{getDisplayElementById(NavExamples.default)}
1515
</CodeView>
1616

@@ -23,7 +23,7 @@ The navigation bar is composed of a wrapper and 2 required regions:
2323

2424
The markup should follow the order listed above for proper keyboard interaction set by the 508 compliance standards. Each included region inside the wrapper of `.slds-context-bar` needs the appropriate ordering class name, e.g. `.slds-context-bar__primary`.
2525

26-
<CodeView demoStyles="height: 16rem;">
26+
<CodeView demoStyles={getDemoStylesById(NavExamples.default, 'default')}>
2727
{getDisplayElementById(NavExamples.default)}
2828
</CodeView>
2929

@@ -108,7 +108,7 @@ Alternatively, two classes are available to add border using css. Adding the cla
108108

109109
#### Menu Open
110110

111-
<CodeView demoStyles="height: 16rem;">
111+
<CodeView demoStyles={getDemoStylesById(NavExamples.states, 'item-menu-open')}>
112112
{getDisplayElementById(NavExamples.states, 'item-menu-open')}
113113
</CodeView>
114114

ui/components/global-navigation/navigation-bar/example.jsx

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,28 @@
44
import React from 'react';
55
import GlobalNavigation, { ContextBar, NavBarItem } from './';
66

7+
const demoName = 'Navigation Bar - ';
8+
79
/* -----------------------------------------------------------------------------
810
Exports
911
----------------------------------------------------------------------------- */
1012

11-
export const Context = props => (
12-
<div style={{ height: '16rem' }}>{props.children}</div>
13-
);
13+
const defaultComponent = <GlobalNavigation />;
1414

15-
export default <GlobalNavigation />;
15+
export default [
16+
{
17+
id: 'default',
18+
label: demoName + 'Default',
19+
demoStyles: 'height: 16rem;',
20+
storybookStyles: false,
21+
element: defaultComponent
22+
}
23+
];
1624

1725
export let states = [
1826
{
1927
id: 'item-active',
20-
label: 'Item Active',
28+
label: demoName + 'Item Active',
2129
element: (
2230
<ContextBar>
2331
<NavBarItem label="Menu Item" hasNavMenu />
@@ -29,7 +37,9 @@ export let states = [
2937
},
3038
{
3139
id: 'item-menu-open',
32-
label: 'Item Menu Open',
40+
label: demoName + 'Item Menu Open',
41+
demoStyles: 'height: 16rem;',
42+
storybookStyles: true,
3343
element: <GlobalNavigation hasNavMenuOpen />
3444
}
3545
];

ui/components/global-navigation/navigation-bar/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export const NavBarItem = props => {
7171
};
7272

7373
NavBarItem.defaultProps = {
74-
lable: 'Menu Item',
74+
label: 'Menu Item',
7575
hasMenuDropdown: true
7676
};
7777

0 commit comments

Comments
 (0)