Skip to content

Commit 5b5d4ca

Browse files
スタイルの改善とレイアウト調整を行い、記事の表示を最適化
1 parent dde216a commit 5b5d4ca

File tree

3 files changed

+44
-16
lines changed

3 files changed

+44
-16
lines changed

src/app/[article_year]/[month]/[aid]/page.css

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ html {
1010
flex-wrap: wrap;
1111
overflow-x: hidden auto;
1212
min-height: 100vh;
13+
max-width: 90vw;
1314
/* スマートフォン対応 */
1415
}
1516

@@ -58,6 +59,17 @@ html {
5859
/* 最小幅を設定 */
5960
}
6061

62+
.article-detail h1 {
63+
font-size: 2rem;
64+
font-weight: 600;
65+
}
66+
67+
/* 日付 */
68+
.article-detail p {
69+
color: color-mix(in srgb, var(--foreground), var(--background) 50%);
70+
}
71+
72+
6173
.article-thumbnail {
6274
width: 100%;
6375
height: auto;
@@ -66,15 +78,18 @@ html {
6678
}
6779

6880
.article-content {
81+
display: flex;
82+
align-items: stretch;
83+
flex-direction: column;
6984
line-height: 2;
70-
padding: 1rem;
85+
overflow: hidden;
86+
padding: 2px;
7187
}
7288

7389
.article-content pre {
7490
padding: 1em;
7591
border: 1px solid var(--foreground);
76-
max-width: 100vw;
77-
margin: 10px;
92+
width: 100%;
7893
overflow: scroll;
7994
color: var(--foreground);
8095
background-color: var(--background);
@@ -107,6 +122,7 @@ html {
107122
.article-content h5,
108123
.article-content h6,
109124
.article-content p {
125+
color: var(--foreground);
110126
font-weight: 500;
111127
}
112128

@@ -209,23 +225,46 @@ html {
209225
@media (max-width: 768px) {
210226
.article-container {
211227
flex-direction: column;
228+
align-items: center;
229+
justify-content: center;
212230
/* 縦並びに変更 */
213231
}
214232

215233
.toc {
216234
position: relative;
217235
/* stickyを無効化 */
218236
max-height: none;
219-
margin-bottom: 20px;
220237
order: -1;
238+
box-sizing: border-box;
239+
margin-bottom: 4em;
221240
/* 記事の上部に配置 */
222241
}
223242

243+
.article-detail {
244+
position: relative;
245+
margin: 1rem;
246+
}
247+
224248
.other-articles {
225249
position: relative;
226250
/* stickyを無効化 */
227251
top: auto;
228252
margin-top: 20px;
229253
/* 記事の下部に配置 */
230254
}
255+
256+
.article-content {
257+
position: relative;
258+
width: calc(100vw - 64px);
259+
margin: 30px auto;
260+
}
261+
262+
.article-content pre {
263+
width: 100%;
264+
/* 幅を100%に設定 */
265+
overflow-x: auto;
266+
/* 横スクロールを有効化 */
267+
font-size: 0.9rem;
268+
/* 必要に応じてフォントサイズを調整 */
269+
}
231270
}

src/app/[article_year]/[month]/[aid]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export default async function ArticlePage({
6969
/>
7070
)}
7171
<div
72-
className="article-content"
72+
className="article-content "
7373
dangerouslySetInnerHTML={{
7474
__html: article.content.replace(
7575
/<h([1-6])>(.*?)<\/h[1-6]>/g,

src/app/globals.css

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,8 @@ body {
3838
background: var(--background);
3939
color: var(--foreground);
4040
min-height: 100vh;
41-
/* body に min-height を設定 */
4241
}
4342

44-
/* div.container は不要になったか、別の場所で使われている場合は width: 100% を確認 */
45-
/*
46-
div.container {
47-
display: flex;
48-
flex-direction: column;
49-
width: 100%;
50-
min-height: inherit;
51-
}
52-
*/
53-
5443
header {
5544
width: 100%;
5645
background-color: var(--primary);

0 commit comments

Comments
 (0)