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