import { Flex } from "reflexbox/styled-components"; import getConfig from "next/config"; import React, { FC } from "react"; import Router from "next/router"; import useMedia from "use-media"; import Link from "next/link"; import { useStoreState } from "../store"; import styled from "styled-components"; import { RowCenterV } from "./Layout"; import { Button } from "./Button"; import ALink from "./ALink"; const { publicRuntimeConfig } = getConfig(); const Li = styled(Flex).attrs({ ml: [12, 24, 32] })` a { color: inherit; :hover { color: #2196f3; } } `; const LogoImage = styled.div` & > a { position: relative; display: flex; align-items: center; margin: 0 8px 0 0; font-size: 22px; font-weight: bold; text-decoration: none; color: inherit; transition: border-color 0.2s ease-out; } @media only screen and (max-width: 488px) { a { font-size: 18px; } } img { width: 18px; margin-right: 11px; } `; const Header: FC = () => { const { isAuthenticated } = useStoreState(s => s.auth); const isMobile = useMedia({ maxWidth: 640 }); const login = !isAuthenticated && (
  • ); const logout = isAuthenticated && (
  • Log out
  • ); const settings = isAuthenticated && (
  • ); return ( { e.preventDefault(); if (window.location.pathname !== "/") Router.push("/"); }} > {publicRuntimeConfig.SITE_NAME} {!isMobile && (
  • GitHub
  • Report
  • )}
  • Report
  • {logout} {settings} {login}
    ); }; export default Header;