Skip to content

Commit b757b50

Browse files
authored
Merge pull request #187 from OUCC/fix-freshman-lesson
日時と場所を未定(指定なし)の場合は非表示に
2 parents 0af2d06 + 544320f commit b757b50

2 files changed

Lines changed: 22 additions & 15 deletions

File tree

src/components/workshop/Workshop2025Section.astro

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type { ComponentProps } from 'astro/types'
55
66
export interface Item
77
extends Omit<ComponentProps<typeof WorkshopCard>, 'date'> {
8-
date: Date
8+
date?: Date
99
}
1010
export function date(
1111
month: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12,
@@ -64,38 +64,30 @@ export const items: Item[] = [
6464
6565
export const items2: Item[] = [
6666
{
67-
date: date(4, 17),
6867
title: 'Python',
69-
place: 'C301',
7068
circleNames: ['Wani Hackase'],
7169
description:
7270
'Pythonの基礎を学びます。PythonはAIやデータ分析に使用されます。',
7371
},
7472
{
75-
date: date(4, 18),
7673
title: 'HTML, CSS',
77-
place: 'C105',
7874
circleNames: ['再履バス同好会 技術部'],
7975
description:
8076
'HTML, CSSの基礎を学びます。HTML, CSSはwebページの作成に使用されます。',
8177
},
8278
{
83-
date: date(4, 19),
8479
title: 'ハードウェア入門',
85-
place: 'C104',
8680
circleNames: ['ToolBox', 'Robohan'],
8781
description:
8882
'ハードウェアの基礎を学びます。電子回路、センサ、 メカ機構などを扱います。',
8983
},
9084
{
91-
date: date(4, 22),
9285
title: 'TypeScript',
9386
circleNames: ['GGC'],
9487
description:
9588
'TypeScriptの基礎を学びます。TypeScriptはwebサイトの作成に使用されます。',
9689
},
9790
{
98-
date: date(4, 23),
9991
title: 'C/C++',
10092
circleNames: ['RAINBOU'],
10193
description:
@@ -134,7 +126,10 @@ const dateFormat = new Intl.DateTimeFormat('ja-JP', {
134126
<ul class="grid grid-cols-[repeat(auto-fit,minmax(18rem,1fr))] gap-5">
135127
{
136128
items2.map(({ date, ...item }) => (
137-
<WorkshopCard {...item} date={dateFormat.format(date)} />
129+
<WorkshopCard
130+
{...item}
131+
date={date ? dateFormat.format(date) : undefined}
132+
/>
138133
))
139134
}
140135
</ul>

src/components/workshop/WorkshopCard.astro

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { OUTechsCirclesName } from '@/@types/ou-techs-members'
44
import { circles } from '../ou-techs/CircleList.astro'
55
interface Props {
66
title: string
7-
date: string
7+
date?: string
88
description: string
99
place?: string
1010
circleNames?: OUTechsCirclesName[]
@@ -42,10 +42,22 @@ const clubInfos = circles.filter((c) => circleNames?.includes(c.name))
4242
}
4343
</p>
4444
<p class="flex items-center gap-2 text-slate-600">
45-
<Icon name="clock" alt="開催日時" class="w-4" />
46-
<span>{date}</span>
47-
<Icon name="map-pin" alt="開催場所" class="-mr-1 ml-2 w-4" />
48-
<span>{place ?? '未定'}</span>
45+
{
46+
date ? (
47+
<>
48+
<Icon name="clock" alt="開催日時" class="w-4" />
49+
<span class="mr-2">{date}</span>
50+
</>
51+
) : null
52+
}
53+
{
54+
place ? (
55+
<>
56+
<Icon name="map-pin" alt="開催場所" class="-mr-1 w-4" />
57+
<span>{place}</span>
58+
</>
59+
) : null
60+
}
4961
</p>
5062
<p class="text-justify-ja">
5163
{description}

0 commit comments

Comments
 (0)