This repository was archived by the owner on Feb 2, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +37
-25
lines changed
_component/sections/notice Expand file tree Collapse file tree 2 files changed +37
-25
lines changed Original file line number Diff line number Diff line change 1+ import ImageSection from '../Image' ;
12import NoticeCard from './Card' ;
23import { getNotices } from '@/components/loadFiles' ;
34import { css } from '@/styled-system/css' ;
45
5- export default function Notice ( ) {
6+ interface Props {
7+ img : string ;
8+ }
9+
10+ export default function Notice ( { img } : Props ) {
611 const notices = getNotices ( ) ;
712 // ビルド時点での期限が過ぎたお知らせは表示しないï
813 const displayNotices = notices . filter (
914 ( n ) => n . deadline . getTime ( ) > Date . now ( ) ,
1015 ) ;
1116
17+ if ( displayNotices . length === 0 ) {
18+ return null ;
19+ }
20+
1221 return (
13- < section
14- className = { css ( {
15- padding : '50px 0' ,
16- textAlign : 'center' ,
17- } ) }
18- >
19- < h2
22+ < >
23+ < section
2024 className = { css ( {
21- paddingBottom : '30px ' ,
22- fontSize : '2rem ' ,
25+ padding : '50px 0 ' ,
26+ textAlign : 'center ' ,
2327 } ) }
2428 >
25- お知らせ
26- </ h2 >
29+ < h2
30+ className = { css ( {
31+ paddingBottom : '30px' ,
32+ fontSize : '2rem' ,
33+ } ) }
34+ >
35+ お知らせ
36+ </ h2 >
2737
28- < div
29- className = { css ( {
30- marginInline : 'auto' ,
31- maxWidth : '800px' ,
32- } ) }
33- >
34- { displayNotices . map ( ( notice ) => (
35- < NoticeCard key = { notice . id } notice = { notice } />
36- ) ) }
37- </ div >
38- </ section >
38+ < div
39+ className = { css ( {
40+ marginInline : 'auto' ,
41+ maxWidth : '800px' ,
42+ } ) }
43+ >
44+ { displayNotices . map ( ( notice ) => (
45+ < NoticeCard key = { notice . id } notice = { notice } />
46+ ) ) }
47+ </ div >
48+ </ section >
49+
50+ < ImageSection img = { img } />
51+ </ >
3952 ) ;
4053}
Original file line number Diff line number Diff line change @@ -20,8 +20,7 @@ export default function Home() {
2020 return (
2121 < main >
2222 < TopSection message = { mdContents [ 0 ] } images = { [ hero , ...others ] } />
23- < Notice />
24- < ImageSection img = { imagepathes [ 0 ] . path } />
23+ < Notice img = { imagepathes [ 0 ] . path } />
2524 < RecentPosts posts = { posts } />
2625 { mdContents . splice ( 1 ) . map ( ( content , index ) => {
2726 return (
You can’t perform that action at this time.
0 commit comments