mirror of
https://github.com/outline/outline.git
synced 2025-12-20 10:09:43 -06:00
37 lines
908 B
TypeScript
37 lines
908 B
TypeScript
import { observer } from "mobx-react";
|
|
import * as React from "react";
|
|
import { Helmet } from "react-helmet-async";
|
|
import env from "~/env";
|
|
import useStores from "~/hooks/useStores";
|
|
import { useTeamContext } from "./TeamContext";
|
|
|
|
type Props = {
|
|
title: React.ReactNode;
|
|
favicon?: string;
|
|
};
|
|
|
|
const originalShortcutHref = document
|
|
.querySelector('link[rel="shortcut icon"]')
|
|
?.getAttribute("href") as string;
|
|
|
|
const PageTitle = ({ title, favicon }: Props) => {
|
|
const { auth } = useStores();
|
|
const team = useTeamContext() ?? auth.team;
|
|
|
|
return (
|
|
<Helmet>
|
|
<title>
|
|
{team?.name ? `${title} - ${team.name}` : `${title} - ${env.APP_NAME}`}
|
|
</title>
|
|
<link
|
|
rel="shortcut icon"
|
|
type="image/png"
|
|
href={favicon ?? originalShortcutHref}
|
|
key={favicon ?? originalShortcutHref}
|
|
/>
|
|
</Helmet>
|
|
);
|
|
};
|
|
|
|
export default observer(PageTitle);
|