NavBar.tsx 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import React from "react";
  2. import { Button, Navbar, NavDropdown } from "react-bootstrap";
  3. import { Sliders } from "react-feather";
  4. const NavBar = (props: any) => {
  5. const { authors, show } = props;
  6. if (!show) return <div />;
  7. return (
  8. <Navbar bg="dark" variant="dark">
  9. <Navbar.Toggle aria-controls="basic-navbar-nav" />
  10. <Navbar.Collapse id="basic-navbar-nav">
  11. <Navbar.Brand className="mr-auto">Proposals</Navbar.Brand>
  12. <NavDropdown
  13. title={<div className="text-light">per Page</div>}
  14. id="basic-nav-dropdown"
  15. >
  16. <NavDropdown.Divider />
  17. {[10, 25, 50, 100, 250, 500].map((n) => (
  18. <NavDropdown.Item key={n} onClick={() => props.setPerPage(n)}>
  19. {n}
  20. </NavDropdown.Item>
  21. ))}
  22. </NavDropdown>
  23. <NavDropdown
  24. title={<div className="text-light">Creator</div>}
  25. id="basic-nav-dropdown"
  26. >
  27. <NavDropdown.Item
  28. className={"All" === props.author ? "bg-dark text-light" : ""}
  29. onClick={props.selectAuthor}
  30. value=""
  31. >
  32. All
  33. </NavDropdown.Item>
  34. <NavDropdown.Divider />
  35. {Object.keys(authors).map((author) => (
  36. <NavDropdown.Item
  37. key={author}
  38. className={author === props.author ? "bg-dark text-light" : ""}
  39. onClick={props.selectAuthor}
  40. >
  41. {authors[author]}
  42. </NavDropdown.Item>
  43. ))}
  44. </NavDropdown>
  45. <Button
  46. onClick={props.toggleShowTypes}
  47. title="Filter By Proposal Type"
  48. variant="dark"
  49. className="btn-sm m-0 p-0"
  50. >
  51. <Sliders color="white" />
  52. </Button>
  53. </Navbar.Collapse>
  54. </Navbar>
  55. );
  56. };
  57. export default NavBar;