Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

[terra-navigation-side-menu] Added Drill-In view variant #2161

Merged
merged 37 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
8246c6a
drill in
May 13, 2024
7d2db66
Update: styles
MadanKumarGovindaswamy May 13, 2024
3786ec0
status view
May 13, 2024
a811d1c
doc as default, lint
May 13, 2024
9d15eb9
drill in
May 13, 2024
299eed7
Update: styles
MadanKumarGovindaswamy May 13, 2024
b79cc7a
status view
May 13, 2024
ada95d8
doc as default, lint
May 13, 2024
71c6e92
drill in test example
May 14, 2024
f58b95e
Merge branch 'drill-in' of https://github.com/cerner/terra-framework …
MadanKumarGovindaswamy May 14, 2024
d4cd74e
update: styles and lint error
MadanKumarGovindaswamy May 14, 2024
da86321
update: lint error
MadanKumarGovindaswamy May 14, 2024
8a536e2
update jest
MadanKumarGovindaswamy May 14, 2024
445ee8d
update: add jest
MadanKumarGovindaswamy May 14, 2024
0784f7d
wdio tests
May 14, 2024
25d7f20
Merge branch 'drill-in' of https://github.com/cerner/terra-framework …
May 14, 2024
f165d61
update: wdio
MadanKumarGovindaswamy May 14, 2024
ddbd4a0
drill in
May 13, 2024
dba2a14
Update: styles
MadanKumarGovindaswamy May 13, 2024
ab4b025
status view
May 13, 2024
a2a9b24
doc as default, lint
May 13, 2024
7def66e
drill in test example
May 14, 2024
cba1a50
update: styles and lint error
MadanKumarGovindaswamy May 14, 2024
6948c3e
update: lint error
MadanKumarGovindaswamy May 14, 2024
b646892
update jest
MadanKumarGovindaswamy May 14, 2024
2ec3798
wdio tests
May 14, 2024
07e426d
update: add jest
MadanKumarGovindaswamy May 14, 2024
a620630
update: wdio
MadanKumarGovindaswamy May 14, 2024
61f0c26
updated changelog
May 14, 2024
3db5459
updated changelog
May 14, 2024
8e71c0e
update: wdio error
MadanKumarGovindaswamy May 14, 2024
f3cecaa
Merge branch 'drill-in' of https://github.com/cerner/terra-framework …
MadanKumarGovindaswamy May 14, 2024
52d9c7f
Update NavigationSideMenu.jsx
MadanKumarGovindaswamy May 14, 2024
066ee15
using constants
May 15, 2024
5817f44
props desc
May 15, 2024
858d518
using exported consts
May 15, 2024
638d506
side menu fix
May 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions packages/terra-framework-docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

* Added
* Added examples for drill-in view under `terra-navigation-side-menu`

## 1.87.0 - (May 14, 2024)

* Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Badge } from 'terra-navigation-side-menu/package.json?dev-site-package'
import NavigationSideMenuPropsTable from 'terra-navigation-side-menu/src/NavigationSideMenu?dev-site-props-table';

import NavigationSideMenuExample from './example/NavigationSideMenuExample?dev-site-example';
import DrillInExample from "./example/DrillInExample?dev-site-example";

<Badge />

Expand Down Expand Up @@ -38,8 +39,17 @@ import NavigationSideMenu from 'terra-navigation-side-menu';
* [Responsive Support](https://engineering.cerner.com/terra-ui/about/terra-ui/component-standards#responsive-support)
* [Mobile Support](https://engineering.cerner.com/terra-ui/about/terra-ui/component-standards#mobile-support)

### Navigation Side Menu Constants
Enumeration: VARIANTS

|Constant|Type|Description|
|---|---|---|
|**NAVIGATION_SIDE_MENU**|string|Renders Navigation Side Menu View.|
|**DRILL_IN**|string|Renders Drill In View.|

## Examples
<NavigationSideMenuExample title='Navigation Side Menu Example' />
<DrillInExample title='DrillIn Example' />

## Navigation Side Menu Props Table
## Navigation Side Menu Props Table
<NavigationSideMenuPropsTable />
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import React from 'react';
import classNames from 'classnames/bind';
import NavigationSideMenu, { VARIANTS } from 'terra-navigation-side-menu';
import { IconHospital } from 'terra-icon';

import styles from './NavigationSideMenuExample.module.scss';

const cx = classNames.bind(styles);

class DrillInDefault extends React.Component {
constructor(props) {
super(props);

this.handleOnChange = this.handleOnChange.bind(this);

this.state = { selectedMenuKey: 'menu', selectedChildKey: undefined };
}

handleOnChange(event, changeData) {
this.setState({ selectedMenuKey: changeData.selectedMenuKey, selectedChildKey: changeData.selectedChildKey });
}

render() {
const content = (
<NavigationSideMenu
id="test-menu"
menuItems={[
{
key: 'menu', text: 'Hospital Details', childKeys: ['submenu1', 'submenu2', 'submenu3', 'submenu4', 'submenu5'],
},
{
key: 'submenu1',
text: 'Hospital services',
childKeys: ['subsubmenu1', 'subsubmenu2', 'subsubmenu3'],
id: 'test-item-1',
},
{ key: 'submenu2', text: 'Hospital events' },
{
key: 'submenu3', text: 'Hospital Accommodations', isDisabled: true,
},
{ key: 'submenu4', text: 'Hospital Careers' },
{ key: 'submenu5', text: 'Hospital Info', childKeys: [] },
{
key: 'subsubmenu1', text: 'Imaging', id: 'test-item-2',
},
{ key: 'subsubmenu2', text: 'Laboratory' },
{
key: 'subsubmenu3', text: 'Rehabilitation services', childKeys: ['rehab1', 'rehab2', 'rehab3'], icon: <IconHospital />,
},
{ key: 'rehab1', text: 'Rehabilitation services 1' },
{ key: 'rehab2', text: 'Rehabilitation services 2' },
{ key: 'rehab3', text: 'Rehabilitation services 3', childKeys: [] },
]}
onChange={this.handleOnChange}
selectedMenuKey={this.state.selectedMenuKey}
selectedChildKey={this.state.selectedChildKey}
ariaLabel="Sub Menu List"
variant={VARIANTS.DRILL_IN}
/>
);

return (
<div className={cx('content-wrapper')}>
{content}
</div>
);
}
}

export default DrillInDefault;
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import React from 'react';
import classNames from 'classnames/bind';
import NavigationSideMenu, { VARIANTS } from 'terra-navigation-side-menu';
import { IconHospital } from 'terra-icon';
import styles from './NavigationSideMenuDocCommon.module.scss';

const cx = classNames.bind(styles);

class DrillInExample extends React.Component {
constructor(props) {
super(props);

this.handleOnChange = this.handleOnChange.bind(this);
this.resetMenuState = this.resetMenuState.bind(this);
this.fakeRoutingBack = this.fakeRoutingBack.bind(this);

this.state = { selectedMenuKey: 'menu', selectedChildKey: undefined };
}

handleOnChange(event, changeData) {
this.setState({ selectedMenuKey: changeData.selectedMenuKey, selectedChildKey: changeData.selectedChildKey });
}

resetMenuState() {
this.setState({ selectedMenuKey: 'menu', selectedChildKey: undefined });
}

fakeRoutingBack() {
this.setState({ selectedMenuKey: 'fake-parent', selectedChildKey: undefined });
}

render() {
let content;
if (this.state.selectedMenuKey === 'fake-parent') {
content = (
<div className={cx('content')}>
<button type="button" onClick={this.resetMenuState}>
Child Route
</button>
<p>Parent Route</p>
</div>
);
} else {
content = (
<NavigationSideMenu
id="test-menu"
menuItems={[
{
key: 'menu', text: 'Hospital Details', childKeys: ['submenu1', 'submenu2', 'submenu3', 'submenu4', 'submenu5'],
},
{
key: 'submenu1',
text: 'Hospital services',
childKeys: ['subsubmenu1', 'subsubmenu2', 'subsubmenu3'],
id: 'test-item-1',
},
{ key: 'submenu2', text: 'Hospital events' },
{
key: 'submenu3', text: 'Hospital Accommodations',
},
{ key: 'submenu4', text: 'Hospital Careers' },
{ key: 'submenu5', text: 'Hospital Info', childKeys: [] },
{
key: 'subsubmenu1', text: 'Imaging', id: 'test-item-2',
},
{ key: 'subsubmenu2', text: 'Laboratory' },
{
key: 'subsubmenu3', text: 'Rehabilitation services', childKeys: ['rehab1', 'rehab2', 'rehab3'], icon: <IconHospital />,
},
{ key: 'rehab1', text: 'Rehabilitation services 1' },
{ key: 'rehab2', text: 'Rehabilitation services 2' },
{ key: 'rehab3', text: 'Rehabilitation services 3', childKeys: [] },
]}
onChange={this.handleOnChange}
routingStackBack={this.fakeRoutingBack}
selectedMenuKey={this.state.selectedMenuKey}
selectedChildKey={this.state.selectedChildKey}
variant={VARIANTS.DRILL_IN}
/>
);
}

return (
<div className={cx('content-wrapper')}>
{content}
</div>
);
}
}

export default DrillInExample;
3 changes: 3 additions & 0 deletions packages/terra-navigation-side-menu/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

* Added
* Added variant prop to render Drill-in view.

## 2.56.0 - (May 8, 2024)

* Changed
Expand Down
3 changes: 2 additions & 1 deletion packages/terra-navigation-side-menu/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
"terra-content-container": "^3.0.0",
"terra-icon": "^3.19.0",
"terra-theme-context": "^1.9.0",
"terra-visually-hidden-text": "^2.0.0"
"terra-visually-hidden-text": "^2.0.0",
"terra-status-view": "^4.77.0"
},
"peerDependencies": {
"react": "^16.8.5",
Expand Down
29 changes: 26 additions & 3 deletions packages/terra-navigation-side-menu/src/MenuItem.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,20 @@
:local {
.list-item {
background-color: var(--terra-navigation-side-menu-list-item-background-color);
border-bottom: var(--terra-navigation-side-menu-list-item-border-bottom, none);
border-left: var(--terra-navigation-side-menu-list-item-border-left, none);
border-right: var(--terra-navigation-side-menu-list-item-border-right, none);
border-top: var(--terra-navigation-side-menu-list-item-border-top, none);
}

.has-border {
border-bottom: var(--terra-navigation-side-menu-list-item-border-bottom, 1px solid #6F7477);
}

.is-disabled {
cursor: default;
opacity: 30%;
}

.menu-item {
align-items: stretch;
border-bottom: var(--terra-navigation-side-menu-item-border-bottom, none);
Expand Down Expand Up @@ -54,7 +62,7 @@
color: var(--terra-navigation-side-menu-item-hover-chevron-color, #bcbfc0);
}
}

&:focus {
box-shadow: var(--terra-navigation-side-menu-item-focus-box-shadow, none);
outline: var(--terra-navigation-side-menu-focus-outline, 2px dashed #000);
Expand Down Expand Up @@ -125,7 +133,7 @@
box-shadow: var(--terra-navigation-side-menu-item-focus-box-shadow, none);
outline: var(--terra-navigation-side-menu-focus-outline, 2px dashed #000);
outline-offset: var(--terra-navigation-side-menu-focus-outline-offset, -2px);

/* stylelint-disable-next-line max-nesting-depth */
.chevron {
color: var(--terra-navigation-side-menu-item-selected-focus-chevron-color, #909496);
Expand Down Expand Up @@ -156,4 +164,19 @@
width: var(--terra-navigation-side-menu-item-chevron-width, 0.8em);
}
}

.icon {
margin-right: 10px;
}

.is-drill-in {
&:focus {
background-color: var(--terra-navigation-side-menu-outline-view-item-focus-background-color, #EBF6FD);
}

&:hover,
&.is-hovered {
background-color: var(--terra-navigation-side-menu-outline-view-item-hover-background-color, #EBF6FD);
}
}
}
Loading
Loading