Cleanup
This commit is contained in:
parent
73849b7f04
commit
80912cb6e2
|
@ -5,10 +5,11 @@ import { asset } from "../lib/assets.js";
|
|||
type Props = {
|
||||
title?: string;
|
||||
meta?: { [name: string]: string };
|
||||
} & ({ content: string } | { Content(): JSX.Element });
|
||||
Content: () => JSX.Element;
|
||||
};
|
||||
|
||||
export default (props: Props) => {
|
||||
const metaTags = Object.entries(Object.assign({}, SITE_DEFAULT_META, props.meta || {})).map(
|
||||
export default ({ title, meta, Content }: Props) => {
|
||||
const metaTags = Object.entries(Object.assign({}, SITE_DEFAULT_META, meta || {})).map(
|
||||
([name, value]) => <meta name={name} value={value} />,
|
||||
);
|
||||
|
||||
|
@ -18,20 +19,16 @@ export default (props: Props) => {
|
|||
<meta charset="utf-8" />
|
||||
<title
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: [props.title, SITE_TITLE].filter(Boolean).join(" – "),
|
||||
__html: [title, SITE_TITLE].filter(Boolean).join(" – "),
|
||||
}}
|
||||
/>
|
||||
{metaTags}
|
||||
<link rel="stylesheet" type="text/css" href={asset("index.css")} />
|
||||
</head>
|
||||
<body>
|
||||
{"Content" in props ? (
|
||||
<div class="main">
|
||||
<props.Content />
|
||||
<Content />
|
||||
</div>
|
||||
) : (
|
||||
<div class="main" dangerouslySetInnerHTML={{ __html: props.content }} />
|
||||
)}
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue
Block a user