Skip to content

Commit 864923d

Browse files
authored
fix: 画面の横幅が小さいときのページ内の画像とコードブロックのスタイルを改善 (#137)
1 parent 7f0c16e commit 864923d

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

website/bun.lockb

378 Bytes
Binary file not shown.

website/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"@tailwindcss/vite": "^4.1.5",
1818
"@types/bun": "latest",
1919
"hono": "^4.6.13",
20+
"tailwind-merge": "^3.3.0",
2021
"tailwindcss": "^4.1.5",
2122
"vite": "^6.2.5"
2223
}

website/src/components/ui/HtmlContent.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { FC } from "hono/jsx";
2+
import { twMerge } from "tailwind-merge";
23

34
export type HtmlContentProps = {
45
html: string;
@@ -7,7 +8,21 @@ export type HtmlContentProps = {
78
export const HtmlContent: FC<HtmlContentProps> = ({ html }) => {
89
return (
910
<div
10-
class="[&_img]:mx-auto [&_img]:block [&_img]:max-w-full"
11+
class={twMerge([
12+
"overflow-hidden",
13+
"[&_img]:mx-auto",
14+
"[&_img]:block",
15+
"[&_img]:max-w-full",
16+
"[&_img]:h-auto",
17+
"[&_img]:object-contain",
18+
"[&_img]:w-auto",
19+
"[&_pre]:overflow-x-auto",
20+
"[&_pre]:max-w-full",
21+
"[&_pre]:whitespace-pre-wrap",
22+
"[&_pre]:break-all",
23+
"[&_pre_code]:block",
24+
"[&_pre_code]:w-full",
25+
])}
1126
// biome-ignore lint/security/noDangerouslySetInnerHtml: typst-docsで生成されたHTMLを表示する
1227
dangerouslySetInnerHTML={{ __html: html }}
1328
/>

0 commit comments

Comments
 (0)