This repository was archived by the owner on Jan 22, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathapp.jsx
More file actions
52 lines (48 loc) · 1.75 KB
/
app.jsx
File metadata and controls
52 lines (48 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import React from 'react';
import ReactDOM from 'react-dom';
import Navbar from './components/Navbar';
import NavItem from './components/NavItem';
import NavbarHeader from './components/NavbarHeader';
import NavbarItems from './components/NavbarItems';
import NavbarDropdown from './components/NavbarDropdown';
import DropdownMenu from './components/DropdownMenu';
const navitems = [
{link: '#', title: 'Setup'},
{link: '#', title: 'Usage', onClick: function () {
alert('Usage');
}},
{link: '#', title: 'Advanced'},
{link: '#', title: 'Try it out'},
{link: '#', title: 'FAQ'}
];
const dropdownItems = [
{href: '#', name: 'ES2015'},
{href: '#', name: 'Setup', onClick: function (item) {
alert('Setup clicked');
}},
{href: '#', name: 'Usage'},
{href: '#', name: 'Advanced'},
{href: '#', name: 'Try it'},
{href: '#', name: 'FAQ'}
];
const navbarInstance = (
<Navbar>
<NavbarHeader href="http://www.google.com" name="Babel"/>
<NavbarItems>
{navitems.map(item => {
if (typeof(item.onClick) !== 'undefined') {
return <NavItem key={navitems.indexOf(item)} link={item.link} title={item.title} onClick={item.onClick}/>;
} else {
return <NavItem key={navitems.indexOf(item)} link={item.link} title={item.title}/>;
}
})}
<NavbarDropdown name="Dropdown">
<DropdownMenu menuItems={dropdownItems}/>
</NavbarDropdown>
<NavbarDropdown name="Dropdown">
<DropdownMenu menuItems={dropdownItems}/>
</NavbarDropdown>
</NavbarItems>
</Navbar>
);
ReactDOM.render(navbarInstance, document.getElementById('navigation_bar'));