HeaderLeftMenu.tsx 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import React, { FC } from "react";
  2. import { bindActionCreators } from "redux";
  3. import { connect } from "react-redux";
  4. import styled from "styled-components";
  5. import Router from "next/router";
  6. import HeaderMenuItem from "./HeaderMenuItem";
  7. const List = styled.ul`
  8. display: flex;
  9. align-items: flex-end;
  10. list-style: none;
  11. margin: 0 0 3px;
  12. padding: 0;
  13. @media only screen and (max-width: 488px) {
  14. display: none;
  15. }
  16. `;
  17. const HeaderLeftMenu: FC = () => {
  18. const goTo = e => {
  19. e.preventDefault();
  20. const path = e.currentTarget.getAttribute("href");
  21. if (!path || window.location.pathname === path) return;
  22. Router.push(path);
  23. };
  24. return (
  25. <List>
  26. <HeaderMenuItem>
  27. <a
  28. href="//github.com/thedevs-network/kutt"
  29. target="_blank"
  30. rel="noopener noreferrer"
  31. title="GitHub"
  32. >
  33. GitHub
  34. </a>
  35. </HeaderMenuItem>
  36. <HeaderMenuItem>
  37. <a href="/report" title="Report abuse" onClick={goTo}>
  38. Report
  39. </a>
  40. </HeaderMenuItem>
  41. </List>
  42. );
  43. };
  44. export default HeaderLeftMenu;