import React, { useState } from "react"; import { Route } from "react-router-dom"; import { useSelector } from "react-redux"; import { LinkContainer } from "react-router-bootstrap"; import PropTypes from "prop-types"; import Nav from "react-bootstrap/Nav"; import Navbar from "react-bootstrap/Navbar"; import NavDropdown from "react-bootstrap/NavDropdown"; export const AppNavBar = () => { const [expanded, setExpanded] = useState(false); const username = useSelector((state) => state.user.username); const isAdmin = useSelector((state) => state.user.isAdmin); return ( setExpanded(!expanded)} > Canapé ); }; AppNavBar.propTypes = { history: PropTypes.object, }; const Search = ({ path, placeholder, setExpanded, history }) => { const [search, setSearch] = useState(""); const handleSearch = (ev) => { ev.preventDefault(); history.push(`${path}/${encodeURI(search)}`); setExpanded(false); }; return (
handleSearch(ev)}> setSearch(e.target.value)} />
); }; Search.propTypes = { placeholder: PropTypes.string.isRequired, setExpanded: PropTypes.func.isRequired, path: PropTypes.string.isRequired, history: PropTypes.object, }; const MoviesDropdown = () => ( Discover My movies ); const ShowsDropdown = () => ( Discover My shows ); const UserDropdown = (props) => ( ); UserDropdown.propTypes = { username: PropTypes.string.isRequired, isAdmin: PropTypes.bool.isRequired, }; const WishlistDropdown = () => ( Movies Shows ); const TorrentsDropdown = () => { const title = ; return ( Downloads Search ); }; const TorrentsDropdownTitle = () => { const count = useSelector((state) => state.torrents.count); if (count === 0) { return Torrents; } return ( Torrents {count} ); };