Remove unused pageTitle

This commit is contained in:
Kalle
2022-06-18 15:53:53 +03:00
parent c7a50ded65
commit 65aaa54a70
2 changed files with 0 additions and 25 deletions

View File

@@ -1,4 +1,3 @@
import { useMatches } from "@remix-run/react";
import * as React from "react";
import { useWindowSize } from "~/hooks/useWindowSize";
import { HamburgerButton } from "./HamburgerButton";
@@ -12,27 +11,10 @@ export const Layout = React.memo(function Layout({
children: React.ReactNode;
}) {
const [menuOpen, setMenuOpen] = React.useState(false);
const matches = useMatches();
const pageTitleKey = "pageTitle";
// you can set this page title from any loader
// deeper routes take precedence
const pageTitle = matches
.map((match) => match.data)
.filter(Boolean)
.reduceRight((acc: string | null, routeData) => {
if (!acc && typeof routeData[pageTitleKey] === "string") {
return routeData[pageTitleKey];
}
return acc;
}, null);
return (
<>
<header className="layout__header">
<div className="layout__header__title-container">{pageTitle}</div>
<div className="layout__header__right-container">
<UserItem />
<HamburgerButton

View File

@@ -9,13 +9,6 @@
background-color: var(--bg);
}
.layout__header__title-container {
color: var(--text-lighter);
font-size: var(--fonts-sm);
font-weight: var(--bold);
text-align: center;
}
.layout__header__right-container {
display: flex;
gap: var(--s-4);