import { Hono } from "npm:hono";
import { jsxRenderer } from 'npm:hono/jsx-renderer';
import type { FC } from 'hono/jsx';
import { html } from 'npm:hono/html';
import { websiteStyles } from "https://esm.town/v/iamseeley/websiteStyles";
import { personalData } from "https://esm.town/v/iamseeley/personalData";
const app = new Hono();
app.use('*', jsxRenderer(({ children }) => {
return html`<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>${personalData.name} | Server-side Hono</title>
<style>
${websiteStyles}
</style>
</head>
<body>
<header>
<h1>${personalData.name}</h1>
<p>${personalData.label}</p>
</header>
${children}
<footer>
<ul>
${personalData.profiles.map((profile, index) => html`
<li key=${index}>
<a href='${profile.url}' target="_blank" rel="noopener noreferrer">
${profile.network}
</a>
</li>
`)}
</ul>
</footer>
</body>
</html>`;
}));
const Navigation: FC<{ currentPath: string }> = ({ currentPath }) => (
<nav>
{[
{ path: '/', text: 'Home' },
{ path: '/about', text: 'About' },
{ path: '/projects', text: 'Projects' }
].map(link => (
<a
key={link.path}
href={link.path}
class={currentPath === link.path ? 'active' : ''}
>
{link.text}
</a>
))}
</nav>
);
const HomePage: FC = () => (
<>
<Navigation currentPath="/" />
<main>
<h2>Welcome to My Portfolio</h2>
<p>{personalData.summary}</p>
<p><strong>This website is rendered server-side with Hono.</strong></p>
<p>Check out the <a href='https://www.val.town/v/iamseeley/multirouteHono'>source</a> and start building your own site!</p>
</main>
</>
);
const AboutPage: FC = () => (
<>
<Navigation currentPath="/about" />
<main>
<h2>About Me</h2>
<p>{personalData.about}</p>
</main>
</>
);
const ProjectsPage: FC = () => (
<>
<Navigation currentPath="/projects" />
<main>
<h2>My Projects</h2>
{personalData.projects.map((project, index) => (
<a key={index} href={project.url} target="_blank" class="projectLink">
<div class="project">
<h3>{project.name}</h3>
<p>{project.description}</p>
</div>