major: import Fresh 2.0 code (#2449)

🎉
This commit is contained in:
Marvin Hagemeister
2024-05-24 09:40:08 +02:00
committed by GitHub
parent 990357629e
commit 287929e4d2
958 changed files with 15794 additions and 28287 deletions
+33 -6
View File
@@ -1,24 +1,51 @@
import { PageProps } from "$fresh/server.ts";
import { asset } from "@fresh/core/runtime";
import { df } from "../utils/state.ts";
export default function App({ Component }: PageProps) {
export default df.definePage(function App({ Component, state, url }) {
return (
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>My Fresh app</title>
{state.title ? <title>{state.title}</title> : null}
{state.description
? <meta name="description" content={state.description} />
: null}
{state.title
? <meta property="og:title" content={state.title} />
: null}
{state.description
? <meta property="og:description" content={state.description} />
: null}
<meta property="og:type" content="website" />
<meta property="og:url" content={url.href} />
{state.ogImage
? <meta property="og:image" content={state.ogImage} />
: null}
{state.noIndex ? <meta name="robots" content="noindex" /> : null}
<link
rel="preload"
href="/fonts/FixelVariable.woff2"
href={asset("/fonts/FixelVariable.woff2")}
as="font"
type="font/woff2"
crossorigin="true"
/>
<link rel="stylesheet" href="/styles.css" />
<link rel="stylesheet" href={asset("/styles.css")} />
{url.pathname === "/"
? <link rel="stylesheet" href={asset("/prism.css")} />
: null}
{url.pathname.startsWith("/docs/")
? (
<>
<link rel="stylesheet" href={asset("/docsearch.css")} />
<link rel="stylesheet" href={asset("/markdown.css")} />
</>
)
: null}
</head>
<body>
<Component />
</body>
</html>
);
}
});