Deno re-write
This commit is contained in:
12
routes/_404.tsx
Normal file
12
routes/_404.tsx
Normal file
@ -0,0 +1,12 @@
|
||||
import { Head } from "$fresh/runtime.ts";
|
||||
|
||||
export default function Error404() {
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>404 - Page not found</title>
|
||||
</Head>
|
||||
<h1>404 Page Not Found</h1>
|
||||
</>
|
||||
);
|
||||
}
|
17
routes/_app.tsx
Normal file
17
routes/_app.tsx
Normal file
@ -0,0 +1,17 @@
|
||||
import { type PageProps } from "$fresh/server.ts";
|
||||
export default function App({ Component }: PageProps) {
|
||||
return (
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Atridad Lahiji</title>
|
||||
<link rel="stylesheet" href="/styles.css" />
|
||||
<link rel="icon" type="image/x-icon" href="favicon.ico"></link>
|
||||
</head>
|
||||
<body>
|
||||
<Component />
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
94
routes/_layout.tsx
Normal file
94
routes/_layout.tsx
Normal file
@ -0,0 +1,94 @@
|
||||
// routes/_layout.tsx
|
||||
import { PageProps } from "$fresh/server.ts";
|
||||
import { Head } from "$fresh/runtime.ts";
|
||||
|
||||
export default function Layout({ Component, url }: PageProps) {
|
||||
const currentPath = url.pathname;
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<title>Fresh App</title>
|
||||
</Head>
|
||||
<body class="flex flex-col min-h-screen">
|
||||
<main class="flex-grow flex flex-col gap-2 items-center justify-center">
|
||||
<Component />
|
||||
</main>
|
||||
|
||||
<div class="fixed bottom-4 left-1/2 transform -translate-x-1/2 z-20">
|
||||
<ul class="menu menu-horizontal bg-base-200 rounded-box p-2 shadow-lg">
|
||||
<li>
|
||||
<a href="/" class={currentPath === "/" ? "menu-active" : ""}>
|
||||
<div class="tooltip" data-tip="Home">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
class="h-5 w-5"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke="currentColor"
|
||||
>
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="2"
|
||||
d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="/posts"
|
||||
class={currentPath.startsWith("/posts") ? "menu-active" : ""}
|
||||
>
|
||||
<div class="tooltip" data-tip="Posts">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
class="h-5 w-5"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke="currentColor"
|
||||
>
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="2"
|
||||
d="M19 20H5a2 2 0 01-2-2V6a2 2 0 012-2h10a2 2 0 012 2v12a2 2 0 002 2zm0 0l1.406 1.406A2 2 0 0122 22a2 2 0 01-2-2v0zm-9.5-8h4m-2 2v-4"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="/projects"
|
||||
class={currentPath.startsWith("/projects") ? "menu-active" : ""}
|
||||
>
|
||||
<div class="tooltip" data-tip="Projects">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
class="h-5 w-5"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke="currentColor"
|
||||
>
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="2"
|
||||
d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.206.129.4.259.598.37"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
</>
|
||||
);
|
||||
}
|
21
routes/api/joke.ts
Normal file
21
routes/api/joke.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import { FreshContext } from "$fresh/server.ts";
|
||||
|
||||
// Jokes courtesy of https://punsandoneliners.com/randomness/programmer-jokes/
|
||||
const JOKES = [
|
||||
"Why do Java developers often wear glasses? They can't C#.",
|
||||
"A SQL query walks into a bar, goes up to two tables and says “can I join you?”",
|
||||
"Wasn't hard to crack Forrest Gump's password. 1forrest1.",
|
||||
"I love pressing the F5 key. It's refreshing.",
|
||||
"Called IT support and a chap from Australia came to fix my network connection. I asked “Do you come from a LAN down under?”",
|
||||
"There are 10 types of people in the world. Those who understand binary and those who don't.",
|
||||
"Why are assembly programmers often wet? They work below C level.",
|
||||
"My favourite computer based band is the Black IPs.",
|
||||
"What programme do you use to predict the music tastes of former US presidential candidates? An Al Gore Rhythm.",
|
||||
"An SEO expert walked into a bar, pub, inn, tavern, hostelry, public house.",
|
||||
];
|
||||
|
||||
export const handler = (_req: Request, _ctx: FreshContext): Response => {
|
||||
const randomIndex = Math.floor(Math.random() * JOKES.length);
|
||||
const body = JOKES[randomIndex];
|
||||
return new Response(body);
|
||||
};
|
20
routes/index.tsx
Normal file
20
routes/index.tsx
Normal file
@ -0,0 +1,20 @@
|
||||
import SocialLinks from "../components/SocialLinks.tsx";
|
||||
|
||||
export default function Home() {
|
||||
return (
|
||||
<>
|
||||
<img
|
||||
src="/logo.webp"
|
||||
alt="A drawing of Atridad Lahiji by Shelze!"
|
||||
height={200}
|
||||
width={200}
|
||||
/>
|
||||
|
||||
<h1 class="bg-gradient-to-r from-primary via-secondary to-accent bg-clip-text text-transparent text-6xl font-bold">
|
||||
Atridad Lahiji
|
||||
</h1>
|
||||
|
||||
<SocialLinks />
|
||||
</>
|
||||
);
|
||||
}
|
6
routes/posts.tsx
Normal file
6
routes/posts.tsx
Normal file
@ -0,0 +1,6 @@
|
||||
// import { useSignal } from "@preact/signals";
|
||||
// import Counter from "../islands/Counter.tsx";
|
||||
|
||||
export default function Home() {
|
||||
return <h1>Posts Page</h1>;
|
||||
}
|
6
routes/projects.tsx
Normal file
6
routes/projects.tsx
Normal file
@ -0,0 +1,6 @@
|
||||
// import { useSignal } from "@preact/signals";
|
||||
// import Counter from "../islands/Counter.tsx";
|
||||
|
||||
export default function Home() {
|
||||
return <h1>Projects Page</h1>;
|
||||
}
|
Reference in New Issue
Block a user