File tree Expand file tree Collapse file tree 5 files changed +37
-3
lines changed
12-21_kick-off-party-report Expand file tree Collapse file tree 5 files changed +37
-3
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ categories:
55 - events
66image : ./image1.jpg
77author : kmanabe
8+ position : top
89---
910
1011ut.code(); は、2024 年 11 月 22 〜 24 日の合計 3 日間駒場祭に企画を出展しました。今回も多くの方にお越しいただきました。3 日間を通して来場してくださった皆様、ありがとうございました!
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ categories:
55 - events
66image : ./image.jpg
77author : snakamura
8+ fit : contain
89---
910
1011ut.code(); では 2024 年 12 月 21 日にプロジェクト発足会を行いました。
Original file line number Diff line number Diff line change 1+ # 記事ページ
2+
3+ ## frontmatter
4+
5+ | キー | 必須 | 説明 |
6+ | ------------- | ---- | ---|
7+ | ` title ` | ✅ | 記事タイトル|
8+ | ` date ` | ✅ | ** 記事を書いた** 日。|
9+ | ` image ` | ✅ | イメージ画像 |
10+ | ` fit ` | | (画像) object-fit。 default = "cover" |
11+ | ` position ` | | (画像) object-position。 (縦軸上から 横軸左から)。default = "50% 50%" |
12+ | ` categories ` | | 何なんだろうね。 |
13+ | ` author ` | | 著者の id |
14+
15+ ## 画像
16+
17+ 縦横比 3:5 に crop されます。
Original file line number Diff line number Diff line change @@ -52,6 +52,14 @@ const articlesWithExcerpts = await Promise.all(
5252 {
5353 articlesWithExcerpts .map (({ article , text }, i ) => {
5454 const isFeatured = enlarge && i % 11 === 0 ; // 11 記事ごとに大きく表示する
55+ const baseW = 400 ;
56+ const imageWidth = baseW * (isFeatured ? 2 : 1 );
57+ const imageHeight = baseW * (3 / 5 ) * (isFeatured ? 2 : 1 );
58+
59+ article .data .fit ?? = " cover" ;
60+ article .data .position ?? = " center" ;
61+ console .log (article .data );
62+
5563 const additionalProps = isFeatured
5664 ? {
5765 cellClassName: " md:col-span-2 md:row-span-2" ,
@@ -75,12 +83,17 @@ const articlesWithExcerpts = await Promise.all(
7583 <Picture
7684 loading = { i < 5 ? loading : " lazy" }
7785 formats = { [" avif" , " webp" ]}
78- alt = " カバー画像"
86+ position = { article .data .position }
87+ width = { imageWidth }
88+ height = { imageHeight }
89+ alt = " "
90+ fit = { article .data .fit }
7991 src = { article .data .image }
8092 class :list = { [
81- " skeleton min-h-0 w-full rounded-xl object-center " ,
93+ " skeleton min-h-0 w-full rounded-xl" ,
8294 additionalProps .imageClassName ,
8395 ]}
96+ style = { ` aspect-ratio: 5 / 3; object-fit: ${article .data .fit }; object-position: ${article .data .position } ` }
8497 />
8598 <div class = " mt-4 p-1" >
8699 <time class = " block text-sm text-gray-500" >
Original file line number Diff line number Diff line change @@ -11,7 +11,9 @@ export const CreateArticleSchema = ({ image }: { image: ImageFunction }) =>
1111 date : z
1212 . date ( )
1313 . transform ( ( date ) => new TZDate ( date ) . withTimeZone ( "Asia/Tokyo" ) ) ,
14- title : z . string ( ) . nullable ( ) ,
14+ title : z . string ( ) ,
15+ fit : z . string ( ) . optional ( ) ,
16+ position : z . string ( ) . optional ( ) ,
1517 image : image ( ) ,
1618 categories : z . array ( z . string ( ) ) . optional ( ) ,
1719 author : reference ( "members" ) . optional ( ) ,
You can’t perform that action at this time.
0 commit comments