Skip to content

Commit

Permalink
feat: tabではなくspaceに
Browse files Browse the repository at this point in the history
  • Loading branch information
yossydev committed Feb 23, 2024
1 parent a57b0c3 commit c64b6d2
Show file tree
Hide file tree
Showing 9 changed files with 96 additions and 89 deletions.
14 changes: 7 additions & 7 deletions app/global.d.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import {} from "hono";

type Head = {
title?: string;
title?: string;
};

declare module "hono" {
interface ContextRenderer {
(
content: string | Promise<string>,
head?: Head,
): Response | Promise<Response>;
}
interface ContextRenderer {
(
content: string | Promise<string>,
head?: Head,
): Response | Promise<Response>;
}
}
18 changes: 9 additions & 9 deletions app/islands/counter.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { useState } from "hono/jsx";

export default function Counter() {
const [count, setCount] = useState(0);
return (
<div>
<p>{count}</p>
<button type="button" onClick={() => setCount(count + 1)}>
Increment
</button>
</div>
);
const [count, setCount] = useState(0);
return (
<div>
<p>{count}</p>
<button type="button" onClick={() => setCount(count + 1)}>
Increment
</button>
</div>
);
}
24 changes: 12 additions & 12 deletions app/routes/_renderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ import { jsxRenderer } from "hono/jsx-renderer";
import { Script } from "honox/server";

export default jsxRenderer(({ children, title }) => {
return (
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{title}</title>
<Script src="/app/client.ts" async />
<Style />
</head>
<body>{children}</body>
</html>
);
return (
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{title}</title>
<Script src="/app/client.ts" async />
<Style />
</head>
<body>{children}</body>
</html>
);
});
16 changes: 8 additions & 8 deletions app/routes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { createRoute } from "honox/factory";
import Counter from "../islands/counter";

export default createRoute((c) => {
const name = c.req.query("name") ?? "Hono";
return c.render(
<div>
<h1 className="text-3xl font-bold underline">Hello world! {name}</h1>
<Counter />
</div>,
{ title: name },
);
const name = c.req.query("name") ?? "Hono";
return c.render(
<div>
<h1 className="text-3xl font-bold underline">Hello world! {name}</h1>
<Counter />
</div>,
{ title: name },
);
});
27 changes: 17 additions & 10 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
{
"$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
}
"$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
"organizeImports": {
"enabled": true
},
"formatter": {
"enabled": true,
"formatWithErrors": true,
"indentStyle": "space",
"indentWidth": 2,
"lineWidth": 80
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
}
}
52 changes: 26 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
{
"name": "blog",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build --mode client && vite build",
"preview": "wrangler pages dev ./dist",
"deploy": "$npm_execpath run build && wrangler pages deploy ./dist",
"format": "biome format . --write",
"lint": "biome lint .",
"check": "biome check --apply ."
},
"private": true,
"dependencies": {
"hono": "^4.0.5",
"honox": "^0.1.4"
},
"devDependencies": {
"@biomejs/biome": "1.5.3",
"@cloudflare/workers-types": "^4.20240208.0",
"@hono/vite-cloudflare-pages": "^0.2.4",
"autoprefixer": "^10.4.17",
"postcss": "^8.4.35",
"tailwindcss": "^3.4.1",
"vite": "^5.0.12",
"wrangler": "^3.27.0"
}
"name": "blog",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build --mode client && vite build",
"preview": "wrangler pages dev ./dist",
"deploy": "$npm_execpath run build && wrangler pages deploy ./dist",
"format": "biome format --write .",
"lint": "biome lint .",
"check": "biome check --apply ."
},
"private": true,
"dependencies": {
"hono": "^4.0.5",
"honox": "^0.1.4"
},
"devDependencies": {
"@biomejs/biome": "1.5.3",
"@cloudflare/workers-types": "^4.20240208.0",
"@hono/vite-cloudflare-pages": "^0.2.4",
"autoprefixer": "^10.4.17",
"postcss": "^8.4.35",
"tailwindcss": "^3.4.1",
"vite": "^5.0.12",
"wrangler": "^3.27.0"
}
}
8 changes: 4 additions & 4 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};
10 changes: 5 additions & 5 deletions tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/** @type {import('tailwindcss').Config} */
export default {
content: ["./app/**/*.{js,ts,jsx,tsx}"],
theme: {
extend: {},
},
plugins: [],
content: ["./app/**/*.{js,ts,jsx,tsx}"],
theme: {
extend: {},
},
plugins: [],
};
16 changes: 8 additions & 8 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import client from "honox/vite/client";
import { defineConfig } from "vite";

export default defineConfig(({ mode }) => {
if (mode === "client") {
return {
plugins: [client()],
};
}
return {
plugins: [honox(), pages()],
};
if (mode === "client") {
return {
plugins: [client()],
};
}
return {
plugins: [honox(), pages()],
};
});

0 comments on commit c64b6d2

Please sign in to comment.