diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bcab6ef --- /dev/null +++ b/.gitignore @@ -0,0 +1,12 @@ +node_modules +dist +.wrangler +.dev.vars +.hono + +# Change them to your taste: +wrangler.toml +package-lock.json +yarn.lock +pnpm-lock.yaml +bun.lockb \ No newline at end of file diff --git a/app/client.ts b/app/client.ts new file mode 100644 index 0000000..16ecf96 --- /dev/null +++ b/app/client.ts @@ -0,0 +1,3 @@ +import { createClient } from 'honox/client' + +createClient() diff --git a/app/global.d.ts b/app/global.d.ts new file mode 100644 index 0000000..288f02b --- /dev/null +++ b/app/global.d.ts @@ -0,0 +1,15 @@ +import {} from 'hono' + +type Head = { + title?: string +} + +declare module 'hono' { + interface Env { + Variables: {} + Bindings: {} + } + interface ContextRenderer { + (content: string | Promise, head?: Head): Response | Promise + } +} diff --git a/app/islands/counter.tsx b/app/islands/counter.tsx new file mode 100644 index 0000000..0bb5438 --- /dev/null +++ b/app/islands/counter.tsx @@ -0,0 +1,11 @@ +import { useState } from 'hono/jsx' + +export default function Counter() { + const [count, setCount] = useState(0) + return ( +
+

{count}

+ +
+ ) +} diff --git a/app/routes/_renderer.tsx b/app/routes/_renderer.tsx new file mode 100644 index 0000000..f72c28f --- /dev/null +++ b/app/routes/_renderer.tsx @@ -0,0 +1,18 @@ +import { Style } from 'hono/css' +import { jsxRenderer } from 'hono/jsx-renderer' +import { Script } from 'honox/server' + +export default jsxRenderer(({ children, title }) => { + return ( + + + + + {title} +