|
1 | 1 | import Link from 'next/link'; |
2 | 2 | import { css } from '@design-system/ui-lib/css'; |
3 | 3 | import { SsgoiTransition } from '@ssgoi/react'; |
| 4 | +import { getAllPosts } from '@/lib/posts'; |
| 5 | +import { TopPosts } from '@/src/components/home/TopPosts'; |
| 6 | +import { PostCard } from '@/src/components/home/PostCard'; |
4 | 7 |
|
5 | 8 | export default function HomePage() { |
| 9 | + const allPosts = getAllPosts(); |
| 10 | + const recentPosts = allPosts.slice(0, 3); |
| 11 | + |
6 | 12 | return ( |
7 | 13 | <SsgoiTransition id="/"> |
8 | 14 | <div |
9 | 15 | className={css({ |
10 | | - minHeight: 'calc(100lvh - 231px)', // Deducting nav height |
11 | | - display: 'flex', |
12 | | - flexDirection: 'column', |
13 | | - alignItems: 'center', |
14 | | - justifyContent: 'center', |
| 16 | + minHeight: 'calc(100lvh - 231px)', |
15 | 17 | bg: 'white', |
16 | | - px: '6', |
17 | | - textAlign: 'center', |
18 | 18 | })} |
19 | 19 | > |
20 | | - <main |
| 20 | + {/* Hero Section */} |
| 21 | + <div |
21 | 22 | className={css({ |
22 | | - maxWidth: '2xl', |
23 | | - w: 'full', |
| 23 | + display: 'flex', |
| 24 | + flexDirection: 'column', |
| 25 | + alignItems: 'center', |
| 26 | + justifyContent: 'center', |
| 27 | + py: '20', |
| 28 | + px: '6', |
| 29 | + textAlign: 'center', |
| 30 | + bg: 'gray.50', |
| 31 | + borderBottomWidth: '1px', |
| 32 | + borderColor: 'gray.100', |
24 | 33 | })} |
25 | 34 | > |
26 | | - <div |
27 | | - className={css({ |
28 | | - display: 'inline-block', |
29 | | - px: '3', |
30 | | - py: '1', |
31 | | - rounded: 'full', |
32 | | - bg: 'blue.50', |
33 | | - color: 'blue.600', |
34 | | - fontSize: 'xs', |
35 | | - fontWeight: 'semibold', |
36 | | - mb: '6', |
37 | | - borderWidth: '1px', |
38 | | - borderColor: 'blue.100', |
39 | | - })} |
40 | | - > |
41 | | - Welcome to FE Lab |
42 | | - </div> |
43 | | - <h1 |
44 | | - className={css({ |
45 | | - fontSize: { base: '5xl', md: '7xl' }, |
46 | | - fontWeight: 'extrabold', |
47 | | - letterSpacing: 'tight', |
48 | | - lineHeight: '1.1', |
49 | | - mb: '6', |
50 | | - color: 'gray.900', |
51 | | - })} |
52 | | - > |
53 | | - Frontend <br /> |
54 | | - <span |
| 35 | + <main className={css({ maxWidth: '2xl', w: 'full' })}> |
| 36 | + <div |
55 | 37 | className={css({ |
56 | | - bgGradient: 'to-r', |
57 | | - gradientFrom: 'blue.600', |
58 | | - gradientTo: 'purple.600', |
59 | | - bgClip: '[text]', |
60 | | - color: 'transparent', |
| 38 | + display: 'inline-block', |
| 39 | + px: '3', |
| 40 | + py: '1', |
| 41 | + rounded: 'full', |
| 42 | + bg: 'blue.50', |
| 43 | + color: 'blue.600', |
| 44 | + fontSize: 'xs', |
| 45 | + fontWeight: 'semibold', |
| 46 | + mb: '6', |
| 47 | + borderWidth: '1px', |
| 48 | + borderColor: 'blue.100', |
61 | 49 | })} |
62 | 50 | > |
63 | | - Experiment Lab |
64 | | - </span> |
65 | | - </h1> |
66 | | - <p |
67 | | - className={css({ |
68 | | - fontSize: { base: 'lg', md: 'xl' }, |
69 | | - color: 'gray.600', |
70 | | - mb: '10', |
71 | | - lineHeight: 'relaxed', |
72 | | - })} |
73 | | - > |
74 | | - 번들러 밑바닥부터 대규모 아키텍처까지, <br /> |
75 | | - 실험하고 기록하며 성장하는 프론트엔드 엔지니어의 공간입니다. |
76 | | - </p> |
| 51 | + Welcome to FE Lab |
| 52 | + </div> |
| 53 | + <h1 |
| 54 | + className={css({ |
| 55 | + fontSize: { base: '5xl', md: '7xl' }, |
| 56 | + fontWeight: 'extrabold', |
| 57 | + letterSpacing: 'tight', |
| 58 | + lineHeight: '1.1', |
| 59 | + mb: '6', |
| 60 | + color: 'gray.900', |
| 61 | + })} |
| 62 | + > |
| 63 | + Frontend <br /> |
| 64 | + <span |
| 65 | + className={css({ |
| 66 | + bgGradient: 'to-r', |
| 67 | + gradientFrom: 'blue.600', |
| 68 | + gradientTo: 'purple.600', |
| 69 | + bgClip: '[text]', |
| 70 | + color: 'transparent', |
| 71 | + })} |
| 72 | + > |
| 73 | + Experiment Lab |
| 74 | + </span> |
| 75 | + </h1> |
| 76 | + <p |
| 77 | + className={css({ |
| 78 | + fontSize: { base: 'lg', md: 'xl' }, |
| 79 | + color: 'gray.600', |
| 80 | + mb: '10', |
| 81 | + lineHeight: 'relaxed', |
| 82 | + })} |
| 83 | + > |
| 84 | + 번들러 밑바닥부터 대규모 아키텍처까지, <br /> |
| 85 | + 실험하고 기록하며 성장하는 프론트엔드 엔지니어의 공간입니다. |
| 86 | + </p> |
| 87 | + |
| 88 | + <div className={css({ display: 'flex', gap: '4', justifyContent: 'center' })}> |
| 89 | + <Link |
| 90 | + href="/posts" |
| 91 | + className={css({ |
| 92 | + px: '8', |
| 93 | + py: '4', |
| 94 | + bg: 'gray.900', |
| 95 | + color: 'white', |
| 96 | + rounded: 'xl', |
| 97 | + fontWeight: 'semibold', |
| 98 | + transition: 'all 0.2s', |
| 99 | + _hover: { |
| 100 | + bg: 'gray.800', |
| 101 | + transform: 'translateY(-2px)', |
| 102 | + shadow: 'lg', |
| 103 | + }, |
| 104 | + _active: { transform: 'translateY(0)' }, |
| 105 | + })} |
| 106 | + > |
| 107 | + 실험 기록 읽기 |
| 108 | + </Link> |
| 109 | + </div> |
| 110 | + </main> |
| 111 | + </div> |
77 | 112 |
|
| 113 | + {/* Top Posts Section (Client Component) */} |
| 114 | + <TopPosts posts={allPosts} /> |
| 115 | + |
| 116 | + {/* Recent Posts Section */} |
| 117 | + <section className={css({ py: '20', px: '6', maxWidth: '7xl', mx: 'auto', borderTopWidth: '1px', borderColor: 'gray.100' })}> |
| 118 | + <h2 className={css({ fontSize: '3xl', fontWeight: 'bold', mb: '10', textAlign: 'center' })}> |
| 119 | + ✨ 최근 등록된 실험 기록 |
| 120 | + </h2> |
78 | 121 | <div |
79 | 122 | className={css({ |
80 | | - display: 'flex', |
81 | | - gap: '4', |
82 | | - justifyContent: 'center', |
| 123 | + display: 'grid', |
| 124 | + gridTemplateColumns: { base: '1fr', md: '3fr' }, |
| 125 | + gap: '8', |
83 | 126 | })} |
84 | 127 | > |
| 128 | + {recentPosts.map(post => ( |
| 129 | + <PostCard key={post.slug} post={post} /> |
| 130 | + ))} |
| 131 | + </div> |
| 132 | + <div className={css({ mt: '12', textAlign: 'center' })}> |
85 | 133 | <Link |
86 | 134 | href="/posts" |
87 | 135 | className={css({ |
88 | | - px: '8', |
89 | | - py: '4', |
90 | | - bg: 'gray.900', |
91 | | - color: 'white', |
92 | | - rounded: 'xl', |
| 136 | + display: 'inline-flex', |
| 137 | + alignItems: 'center', |
| 138 | + px: '6', |
| 139 | + py: '3', |
| 140 | + rounded: 'full', |
| 141 | + borderWidth: '1px', |
| 142 | + borderColor: 'gray.200', |
| 143 | + color: 'gray.600', |
93 | 144 | fontWeight: 'semibold', |
94 | 145 | transition: 'all 0.2s', |
95 | 146 | _hover: { |
96 | | - bg: 'gray.800', |
97 | | - transform: 'translateY(-2px)', |
98 | | - shadow: 'lg', |
| 147 | + borderColor: 'blue.600', |
| 148 | + color: 'blue.600', |
| 149 | + bg: 'blue.50', |
99 | 150 | }, |
100 | | - _active: { transform: 'translateY(0)' }, |
101 | 151 | })} |
102 | 152 | > |
103 | | - 실험 기록 읽기 |
| 153 | + 모든 기록 보기 <span className={css({ ml: '2' })}>→</span> |
104 | 154 | </Link> |
105 | 155 | </div> |
106 | | - </main> |
| 156 | + </section> |
107 | 157 | </div> |
108 | 158 | </SsgoiTransition> |
109 | 159 | ); |
|
0 commit comments