updated navbar
- dropdown now iterates over episodes - uses client-side routing to find episode comments
This commit is contained in:
parent
26a0833671
commit
1b1a6e8f78
@ -1,25 +1,27 @@
|
||||
import React from 'react'
|
||||
import {connect} from 'react-redux'
|
||||
import { Navbar, Nav, NavDropdown, FormControl, Form, Button } from 'react-bootstrap'
|
||||
import fetchEpisodes from './fetchEpisodes'
|
||||
const MainNav = () => {
|
||||
import {LinkContainer} from 'react-router-bootstrap'
|
||||
import {NavLink} from 'react-router-dom'
|
||||
|
||||
const MainNav = (props) => {
|
||||
const {episodes, captions} = props
|
||||
|
||||
return (
|
||||
<Navbar bg="dark" variant="dark" expand="lg">
|
||||
<Navbar.Brand href="#home">Anarchy Planet</Navbar.Brand>
|
||||
<Navbar.Brand href="/">Anarchy Planet</Navbar.Brand>
|
||||
<Navbar.Toggle aria-controls="basic-navbar-nav" />
|
||||
<Navbar.Collapse id="basic-navbar-nav">
|
||||
<Nav className="mr-auto">
|
||||
<Nav.Link href="#" onClick={fetchEpisodes}>
|
||||
Episodes
|
||||
</Nav.Link>
|
||||
<Nav.Link href="#link">Link</Nav.Link>
|
||||
<NavDropdown title="Dropdown" id="basic-nav-dropdown">
|
||||
<NavDropdown.Item href="#action/3.1">Action</NavDropdown.Item>
|
||||
<NavDropdown.Item href="#action/3.2">Another action</NavDropdown.Item>
|
||||
<NavDropdown.Item href="#action/3.3">Something</NavDropdown.Item>
|
||||
<NavDropdown.Divider />
|
||||
<NavDropdown.Item href="#action/3.4">Separated link</NavDropdown.Item>
|
||||
<NavDropdown title="Episodes" id="episodes">
|
||||
{episodes.map(episode=>
|
||||
<NavLink className="dropdown-item" key={episode.slug} to={`/captions/${episode.slug}`}>
|
||||
{episode.title}
|
||||
</NavLink>
|
||||
)}
|
||||
</NavDropdown>
|
||||
</Nav>
|
||||
|
||||
<Form inline>
|
||||
<FormControl type="text" placeholder="Search" className="mr-sm-2" />
|
||||
<Button variant="outline-success">Search</Button>
|
||||
@ -29,4 +31,12 @@ const MainNav = () => {
|
||||
)
|
||||
}
|
||||
|
||||
export default MainNav
|
||||
const mapState = state => {
|
||||
return {
|
||||
episodes: state.episodes,
|
||||
captions: state.captions
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export default connect(mapState)(MainNav)
|
||||
|
Loading…
x
Reference in New Issue
Block a user