diff --git a/src/web/display/Layout.tsx b/src/web/display/Layout.tsx index c85e704..6993e90 100644 --- a/src/web/display/Layout.tsx +++ b/src/web/display/Layout.tsx @@ -4,15 +4,32 @@ import React, { ErrorInfo } from "react"; import { Logo2 } from "../icons/index"; -/* Utilities */ -const classNameSelected = (isSelected: boolean) => - `no-underline py-4 px-2 ml-4 text-md font-medium cursor-pointer border-b-2 border-transparent ${ - isSelected - ? "text-blue-700 border-blue-700" - : "text-gray-400 hover:text-blue-500 hover:border-blue-500" - }`; +interface MenuItem { + page: string; + link: string; + title: string; +} -let calculateLastUpdate = () => { +const menu: MenuItem[] = [ + { + page: "search", + link: "/", + title: "Search", + }, + { + page: "tools", + link: "/tools", + title: "Tools", + }, + { + page: "about", + link: "/about", + title: "About", + }, +]; + +/* Utilities */ +const calculateLastUpdate = () => { let today = new Date().toISOString(); let yesterdayObj = new Date(); yesterdayObj.setDate(yesterdayObj.getDate() - 1); @@ -66,26 +83,16 @@ class ErrorBoundary extends React.Component< } } +interface Props { + page: string; // id used for menu +} + /* Main */ -export const Layout = ({ page, children }) => { +export const Layout: React.FC = ({ page, children }) => { let lastUpdated = calculateLastUpdate(); // The correct way to do this would be by passing a prop to Layout, // and to get the last updating using server side props. - const refreshPage = () => { - // window.location.reload(true); - // window.location.replace(window.location.pathname); - // window.location.reload(); - // https://developer.mozilla.org/en-US/docs/Web/API/Location/reload - // https://developer.mozilla.org/en-US/docs/Web/API/Location/replace - // https://developer.mozilla.org/en-US/docs/Web/API/Location/assign - // window.location.hostname - if (typeof window !== "undefined") { - if ((window.location as any) != window.location.pathname) { - window.location.assign(window.location.pathname); - } - } - }; return (
@@ -95,54 +102,56 @@ export const Layout = ({ page, children }) => {
-
+
{children}