Skip to content

Commit 7f7a624

Browse files
authored
Feature/update navbar docs (#443)
* update Navigation showcase * update DropdownNavigationItem showcase
1 parent defbd75 commit 7f7a624

File tree

10 files changed

+107
-81
lines changed

10 files changed

+107
-81
lines changed

dev-server/containers/MainView/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
33
import { connect } from 'react-redux';
4-
import dynamicsFont from '../../../src/assets/DynamicsFont/DynamicsFont.scss';
54
import TabNavigationView from '../../../src/components/TabNavigationView';
65
import RouterInteraction from '../../../src/modules/RouterInteraction';
76
import DialPadIcon from '../../../src/assets/images/DialPadNav.svg';

docs/src/app/pages/Components/DropdownNavigationView/Demo.js

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,24 @@ import React from 'react';
22
// eslint-disable-next-line
33
import DropdownNavigationView from 'ringcentral-widget/components/DropdownNavigationView';
44
// eslint-disable-next-line
5-
import dynamicsFont from 'ringcentral-widget/assets/DynamicsFont/DynamicsFont.scss';
5+
import ContactIcon from 'ringcentral-widget/assets/images/Contact.svg';
6+
import SettingsIcon from 'ringcentral-widget/assets/images/Settings.svg';
7+
import ContactHoverIcon from 'ringcentral-widget/assets/images/ContactHover.svg';
8+
import SettingsHoverIcon from 'ringcentral-widget/assets/images/SettingsHover.svg';
69

710
const props = {};
811
props.goTo = () => null;
912
props.currentPath = '/settings';
1013
props.tabs = [{
11-
icon: (<span className={dynamicsFont.menu} />),
12-
activeIcon: (<span className={dynamicsFont.menuHover} />),
13-
label: 'More Menu',
14-
virtualPath: '!moreMenu',
15-
isActive: () => true,
16-
childTabs: [{
17-
icon: (<span className={dynamicsFont.portrait} />),
18-
activeIcon: (<span className={dynamicsFont.portrait} />),
19-
label: 'Contacts',
20-
path: '/contacts',
21-
}, {
22-
icon: (<span className={dynamicsFont.setting} />),
23-
activeIcon: (<span className={dynamicsFont.settingHover} />),
24-
label: 'Settings',
25-
path: '/settings',
26-
}],
14+
icon: ContactIcon,
15+
activeIcon: ContactHoverIcon,
16+
label: 'Contacts',
17+
path: '/contacts',
18+
}, {
19+
icon: SettingsIcon,
20+
activeIcon: SettingsHoverIcon,
21+
label: 'Settings',
22+
path: '/settings',
2723
}];
2824

2925
/**

docs/src/app/pages/Components/NavigationBar/Demo.js

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,17 @@ import React from 'react';
22
// eslint-disable-next-line
33
import NavigationBar from 'ringcentral-widget/components/NavigationBar';
44
import TabNavigationButton from 'ringcentral-widget/components/TabNavigationButton';
5-
import dynamicsFont from 'ringcentral-widget/assets/DynamicsFont/DynamicsFont.scss';
5+
import DialPadIcon from 'ringcentral-widget/assets/images/DialPadNav.svg';
6+
import CallsIcon from 'ringcentral-widget/assets/images/Calls.svg';
7+
import HistoryIcon from 'ringcentral-widget/assets/images/CallHistory.svg';
8+
import MessageIcon from 'ringcentral-widget/assets/images/Messages.svg';
9+
import ComposeTextIcon from 'ringcentral-widget/assets/images/ComposeText.svg';
10+
11+
import DialPadHoverIcon from 'ringcentral-widget/assets/images/DialPadHover.svg';
12+
import CallsHoverIcon from 'ringcentral-widget/assets/images/CallsHover.svg';
13+
import HistoryHoverIcon from 'ringcentral-widget/assets/images/CallHistoryHover.svg';
14+
import MessageHoverIcon from 'ringcentral-widget/assets/images/MessagesHover.svg';
15+
import ComposeTextHoverIcon from 'ringcentral-widget/assets/images/ComposeTextHover.svg';
616

717
const props = {};
818
props.currentPath = 'test string';
@@ -13,52 +23,40 @@ props.currentPath = 'test string';
1323
const unreadCounts = 99;
1424
props.tabs = [
1525
{
16-
icon: <span className={dynamicsFont.dial} />,
17-
activeIcon: <span className={dynamicsFont.dialHover} />,
26+
icon: DialPadIcon,
27+
activeIcon: DialPadHoverIcon,
1828
label: 'Dial Pad',
1929
path: '/',
2030
},
2131
{
22-
icon: <span className={dynamicsFont.active} />,
23-
activeIcon: <span className={dynamicsFont.activeHover} />,
32+
icon: CallsIcon,
33+
activeIcon: CallsHoverIcon,
2434
label: 'Calls',
2535
path: '/calls',
2636
},
2737
{
28-
icon: <span className={dynamicsFont.history} />,
29-
activeIcon: <span className={dynamicsFont.historyHover} />,
38+
icon: HistoryIcon,
39+
activeIcon: HistoryHoverIcon,
3040
label: 'History',
3141
path: '/history',
3242
},
3343
{
34-
icon: <span className={dynamicsFont.message} />,
35-
activeIcon: <span className={dynamicsFont.messageHover} />,
44+
icon: MessageIcon,
45+
activeIcon: MessageHoverIcon,
3646
label: 'Messages',
3747
path: '/messages',
3848
noticeCounts: unreadCounts,
3949
isActive: () => true
4050
},
4151
{
42-
icon: <span className={dynamicsFont.composeText} />,
43-
activeIcon: <span className={dynamicsFont.composeTextHover} />,
52+
icon: ComposeTextIcon,
53+
activeIcon: ComposeTextHoverIcon,
4454
label: 'Compose Text',
4555
path: '/composeText',
4656
},
47-
{
48-
icon: <span className={dynamicsFont.conference} />,
49-
activeIcon: <span className={dynamicsFont.conferenceHover} />,
50-
label: 'Conference',
51-
path: '/conference',
52-
},
53-
{
54-
icon: <span className={dynamicsFont.setting} />,
55-
activeIcon: <span className={dynamicsFont.settingHover} />,
56-
label: 'Settings',
57-
path: '/settings',
58-
},
5957
];
6058

61-
props.goTo = (path) => alert(`go to ${path}`)
59+
props.goTo = path => alert(`go to ${path}`);
6260
const NavigationBarDemo = () => (
6361
<NavigationBar
6462
button={TabNavigationButton}

docs/src/app/pages/Components/RadioBtnGroup/Demo.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,17 @@ import RadioBtnGroup from 'ringcentral-widget/components/RadioBtnGroup';
44

55
const props = {};
66
props.className = 'test string';
7-
props.radioOptions = [];
7+
props.radioOptions = [{
8+
id: '123',
9+
label: 'Home',
10+
phoneNumber: '+12345678'
11+
}, {
12+
id: '1234',
13+
label: 'Mobile',
14+
phoneNumber: '+123456789'
15+
}];
816
props.disabled = false;
9-
props.formatPhone = () => null;
17+
props.formatPhone = v => v;
1018
props.onRadioSelect = () => null;
1119

1220
/**
Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
import React from 'react';
22
// eslint-disable-next-line
33
import TabNavigationButton from 'ringcentral-widget/components/TabNavigationButton';
4+
import CallsIcon from 'ringcentral-widget/assets/images/Calls.svg';
5+
import CallsHoverIcon from 'ringcentral-widget/assets/images/CallsHover.svg';
46

57
const props = {};
6-
props.icon = (<span>Node</span>);
7-
props.activeIcon = (<span>Node</span>);
8-
props.width = undefined;
8+
props.icon = <CallsIcon />;
9+
props.activeIcon = <CallsHoverIcon />;
10+
props.width = '100%';
911

1012
/**
1113
* A example of `TabNavigationButton`
1214
*/
1315
const TabNavigationButtonDemo = () => (
14-
<TabNavigationButton
15-
{...props}
16-
/>
16+
<div style={{ width: '200px', height: '46px', background: '#0684bd' }}>
17+
<TabNavigationButton
18+
{...props}
19+
/>
20+
</div>
1721
);
1822
export default TabNavigationButtonDemo;

docs/src/app/pages/Components/TabNavigationView/Demo.js

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,42 @@
11
import React, { Component } from 'react';
22
// eslint-disable-next-line
33
import TabNavigationView from 'ringcentral-widget/components/TabNavigationView';
4-
import dynamicsFont from 'ringcentral-widget/assets/DynamicsFont/DynamicsFont.scss';
4+
import DialPadIcon from 'ringcentral-widget/assets/images/DialPadNav.svg';
5+
import CallsIcon from 'ringcentral-widget/assets/images/Calls.svg';
6+
import MessageIcon from 'ringcentral-widget/assets/images/Messages.svg';
7+
import SettingsIcon from 'ringcentral-widget/assets/images/Settings.svg';
8+
import ContactIcon from 'ringcentral-widget/assets/images/Contact.svg';
9+
import MoreMenuIcon from 'ringcentral-widget/assets/images/MoreMenu.svg';
10+
11+
import DialPadHoverIcon from 'ringcentral-widget/assets/images/DialPadHover.svg';
12+
import CallsHoverIcon from 'ringcentral-widget/assets/images/CallsHover.svg';
13+
import MessageHoverIcon from 'ringcentral-widget/assets/images/MessagesHover.svg';
14+
import SettingsHoverIcon from 'ringcentral-widget/assets/images/SettingsHover.svg';
15+
import ContactHoverIcon from 'ringcentral-widget/assets/images/ContactHover.svg';
16+
import MoreMenuHoverIcon from 'ringcentral-widget/assets/images/MoreMenuHover.svg';
17+
18+
import ContactNavIcon from 'ringcentral-widget/assets/images/ContactsNavigation.svg';
19+
import SettingsNavIcon from 'ringcentral-widget/assets/images/SettingsNavigation.svg';
520

621
const tabs = [
722
{
8-
icon: <span className={dynamicsFont.dial} />,
9-
activeIcon: <span className={dynamicsFont.dialHover} />,
23+
icon: DialPadIcon,
24+
activeIcon: DialPadHoverIcon,
1025
label: 'Dial Pad',
1126
path: '/dialer',
1227
},
1328
{
14-
icon: <span className={dynamicsFont.active} />,
15-
activeIcon: <span className={dynamicsFont.activeHover} />,
29+
icon: CallsIcon,
30+
activeIcon: CallsHoverIcon,
1631
label: 'Calls',
1732
path: '/calls',
1833
isActive: currentPath => (
1934
currentPath === '/calls' || currentPath === '/calls/active'
2035
),
2136
},
2237
{
23-
icon: <span className={dynamicsFont.message} />,
24-
activeIcon: <span className={dynamicsFont.messageHover} />,
38+
icon: MessageIcon,
39+
activeIcon: MessageHoverIcon,
2540
label: 'Messages',
2641
path: '/messages',
2742
noticeCounts: 1,
@@ -30,23 +45,30 @@ const tabs = [
3045
),
3146
},
3247
{
33-
icon: <span className={dynamicsFont.menu} />,
34-
activeIcon: <span className={dynamicsFont.menuHover} />,
48+
icon: ({ currentPath }) => {
49+
if (currentPath === '/contacts') {
50+
return <ContactNavIcon />;
51+
} else if (currentPath === '/settings') {
52+
return <SettingsNavIcon />;
53+
}
54+
return <MoreMenuIcon />;
55+
},
56+
activeIcon: MoreMenuHoverIcon,
3557
label: 'More Menu',
3658
virtualPath: '!moreMenu',
3759
isActive: (currentPath, currentVirtualPath) => (
3860
currentVirtualPath === '!moreMenu'
3961
),
4062
childTabs: [
4163
{
42-
icon: <span className={dynamicsFont.portrait} />,
43-
activeIcon: <span className={dynamicsFont.portrait} />,
64+
icon: ContactIcon,
65+
activeIcon: ContactHoverIcon,
4466
label: 'Contacts',
4567
path: '/contacts',
4668
},
4769
{
48-
icon: <span className={dynamicsFont.setting} />,
49-
activeIcon: <span className={dynamicsFont.settingHover} />,
70+
icon: SettingsIcon,
71+
activeIcon: SettingsHoverIcon,
5072
label: 'Settings',
5173
path: '/settings',
5274
isActive: currentPath => (

src/components/DropdownNavigationItem/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default function DropdownNavigationItem({
1111
label,
1212
noticeCounts,
1313
onClick,
14-
}) {
14+
}) {
1515
let notice = null;
1616
if (noticeCounts && noticeCounts > 0) {
1717
if (noticeCounts > 99) {

src/components/DropdownNavigationView/index.js

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,23 +55,14 @@ export default class DropdownNavigationView extends Component {
5555
currentVirtualPath,
5656
} = this.props;
5757

58-
const activeTab = tabs.find(tab =>
59-
tab.childTabs &&
60-
(
61-
(tab.isActive && tab.isActive(currentPath, currentVirtualPath)) ||
62-
(tab.path && tab.path === currentPath) ||
63-
(tab.virtualPath && tab.virtualPath === currentVirtualPath)
64-
)
65-
);
66-
6758
return (
68-
activeTab && activeTab.childTabs.length ? (
59+
tabs.length ? (
6960
<div
7061
className={styles.root}
7162
ref={(el) => { this.setChildNavigationElement(el); }}
7263
>
7364
{
74-
activeTab.childTabs.map((tab, index) => {
65+
tabs.map((tab, index) => {
7566
const Icon = tab.icon;
7667
const ActiveIcon = tab.activeIcon;
7768
return (
@@ -88,7 +79,7 @@ export default class DropdownNavigationView extends Component {
8879
}
8980
icon={typeof Icon === 'function' ? <Icon /> : Icon}
9081
activeIcon={typeof ActiveIcon === 'function' ? <ActiveIcon /> : ActiveIcon}
91-
/>
82+
/>
9283
);
9384
})
9485
}

src/components/NavigationBar/index.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,20 @@ export default class NavigationBar extends Component {
4747
const tabWidth = tabs.length > 0 ?
4848
`${(1 / tabs.length) * 100}%` :
4949
0;
50+
const dropdownMenuTab = tabs.find(tab =>
51+
(
52+
tab.childTabs &&
53+
(tab.isActive && tab.isActive(currentPath, currentVirtualPath))
54+
)
55+
);
56+
const dropdownMenu = dropdownMenuTab && dropdownMenuTab.childTabs;
5057
return (
5158
<nav className={classnames(styles.root, className)}>
5259
{
5360
tabs.map((tab, index) => {
54-
const Icon = tab.icon;
55-
let icon = Icon;
56-
if (typeof Icon === 'function') {
61+
let icon = tab.icon;
62+
if (typeof icon === 'function') {
63+
const Icon = tab.icon;
5764
icon = (tab.childTabs ? <Icon currentPath={currentPath} /> : <Icon />);
5865
}
5966
const ActiveIcon = tab.activeIcon;
@@ -77,9 +84,9 @@ export default class NavigationBar extends Component {
7784
})
7885
}
7986
{
80-
ChildNavigationView ? (
87+
(ChildNavigationView && dropdownMenu && dropdownMenu.length) ? (
8188
<ChildNavigationView
82-
tabs={tabs}
89+
tabs={dropdownMenu}
8390
goTo={this.goTo}
8491
currentPath={currentPath}
8592
currentVirtualPath={currentVirtualPath}

src/components/RadioBtnGroup/styles.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
margin-top: 18px;
1616

1717
.radioBtn {
18+
box-sizing: content-box;
1819
display: inline-block;
1920
position: relative;
2021
width: 15px;

0 commit comments

Comments
 (0)