@@ -24,74 +24,60 @@ const articles = computed(() => {
24
24
)
25
25
})
26
26
})
27
+
28
+ const latestArticle = computed (() => articles .value [0 ])
29
+ const otherArticles = computed (() => articles .value .slice (1 ))
27
30
< / script>
28
31
29
32
< template>
30
- < div>
31
- < h1
32
- class = " text-4xl font-bold tracking-tight text-slate-800 dark:text-slate-100 sm:text-5xl"
33
- >
34
- Blog
35
- < / h1>
36
- < p class = " mt-6 text-base text-slate-600 dark:text-slate-400" >
37
- These articles provide a more in - depth look at the contents of the
38
- < router- link
39
- class = " -underline-offset-4 font-medium text-sky-600 underline"
40
- to= " /"
41
- > Python Cheatsheet< / router- link
42
- > .
43
- < / p>
44
- < / div>
45
-
46
- < div class = " sm:mt-13 mt-20" >
47
- < div
48
- class = " md:border-l md:border-slate-100 md:pl-6 md:dark:border-slate-700/40"
33
+ < div v- if = " latestArticle" class = " mb-12" >
34
+ < router- link
35
+ : to= " latestArticle.path"
36
+ class = " group block overflow-hidden rounded-lg border border-slate-200 bg-white shadow-md transition-all duration-300 hover:shadow-xl dark:border-slate-700 dark:bg-slate-800"
49
37
>
50
- < div class = " flex max-w-3xl flex-col space-y-16" >
51
- < article
52
- v- for = " article in articles"
53
- v- once
54
- : key= " article.path"
55
- class = " md:grid md:grid-cols-4 md:items-baseline"
56
- >
57
- < div class = " group relative flex flex-col items-start md:col-span-3" >
58
- < h2
59
- class = " text-base font-semibold tracking-tight text-slate-800 dark:text-slate-100"
38
+ < div class = " md:flex" >
39
+ < div class = " md:w-1/2" >
40
+ < img
41
+ v- if = " latestArticle.children[0]?.meta?.socialImage"
42
+ : src= " latestArticle.children[0]?.meta?.socialImage"
43
+ alt= " "
44
+ class = " h-full w-full object-cover transition-transform duration-300 group-hover:scale-105"
45
+ / >
46
+ < div
47
+ v- else
48
+ class = " flex h-full w-full items-center justify-center bg-slate-100 dark:bg-slate-700"
49
+ >
50
+ < svg
51
+ class = " h-12 w-12 text-slate-400"
52
+ xmlns= " http://www.w3.org/2000/svg"
53
+ fill= " none"
54
+ viewBox= " 0 0 24 24"
55
+ stroke= " currentColor"
60
56
>
61
- < div
62
- class = " absolute -inset-x-4 -inset-y-6 z-0 scale-95 bg-slate-100/60 opacity-0 transition group-hover:scale-100 group-hover:opacity-100 dark:bg-slate-800/60 sm:-inset-x-6 sm:rounded-2xl"
57
+ < path
58
+ stroke- linecap= " round"
59
+ stroke- linejoin= " round"
60
+ stroke- width= " 2"
61
+ d= " M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l-1.586-1.586a2 2 0 00-2.828 0L6 18"
63
62
/ >
64
- < router- link : to= " article.path" >
65
- < span
66
- class = " absolute -inset-x-4 -inset-y-6 z-20 sm:-inset-x-6 sm:rounded-2xl"
67
- / >
68
- < span class = " relative z-10" >
69
- {{ article .children [0 ]? .meta ? .title }}
70
- < / span>
71
- < / router- link>
72
- < / h2>
73
- < time
74
- class = " relative z-10 order-first mb-3 flex items-center pl-3.5 text-sm text-slate-400 dark:text-slate-500 md:hidden"
75
- datetime= " 2022-09-05"
76
- >
77
- < span
78
- class = " absolute inset-y-0 left-0 flex items-center"
79
- aria- hidden= " true"
80
- >
81
- < span
82
- class = " h-4 w-0.5 rounded-full bg-slate-200 dark:bg-slate-500"
83
- / >
84
- < / span>
85
- September 5 , 2022
63
+ < / svg>
64
+ < / div>
65
+ < / div>
66
+ < div class = " p-6 md:w-1/2" >
67
+ < h2
68
+ class = " text-2xl font-semibold text-slate-800 dark:text-slate-100"
69
+ >
70
+ {{ latestArticle .children [0 ]? .meta ? .title }}
71
+ < / h2>
72
+ < p class = " mt-2 text-slate-600 dark:text-slate-400" >
73
+ {{ latestArticle .children [0 ]? .meta ? .description }}
74
+ < / p>
75
+ < div class = " mt-4 flex items-center justify-between" >
76
+ < time class = " text-sm text-slate-500 dark:text-slate-400" >
77
+ {{ latestArticle .children [0 ]? .meta ? .date }}
86
78
< / time>
87
- < p
88
- class = " relative z-10 mt-2 text-sm text-slate-600 dark:text-slate-400"
89
- >
90
- {{ article .children [0 ]? .meta ? .description }}
91
- < / p>
92
79
< div
93
- aria- hidden= " true"
94
- class = " relative z-10 mt-4 flex items-center text-sm font-medium text-sky-500"
80
+ class = " flex items-center text-sm font-medium text-sky-500"
95
81
>
96
82
Read article
97
83
< svg
@@ -109,18 +95,79 @@ const articles = computed(() => {
109
95
< / svg>
110
96
< / div>
111
97
< / div>
112
- < time
113
- class = " relative z-10 order-first mb-3 mt-1 hidden items-center text-sm text-slate-400 dark:text-slate-500 md:block"
114
- datetime= " 2022-09-05"
98
+ < / div>
99
+ < / div>
100
+ < / router- link>
101
+ < / div>
102
+
103
+ < div class = " grid gap-8 sm:grid-cols-2 lg:grid-cols-3" >
104
+ < router- link
105
+ v- for = " article in otherArticles"
106
+ : key= " article.path"
107
+ : to= " article.path"
108
+ class = " group block overflow-hidden rounded-lg border border-slate-200 bg-white shadow-md transition-all duration-300 hover:shadow-xl dark:border-slate-700 dark:bg-slate-800"
109
+ >
110
+ < div class = " relative overflow-hidden" >
111
+ < img
112
+ v- if = " article.children[0]?.meta?.socialImage"
113
+ : src= " article.children[0]?.meta?.socialImage"
114
+ alt= " "
115
+ class = " h-48 w-full object-cover transition-transform duration-300 group-hover:scale-105"
116
+ / >
117
+ < div
118
+ v- else
119
+ class = " flex h-48 w-full items-center justify-center bg-slate-100 dark:bg-slate-700"
120
+ >
121
+ < svg
122
+ class = " h-12 w-12 text-slate-400"
123
+ xmlns= " http://www.w3.org/2000/svg"
124
+ fill= " none"
125
+ viewBox= " 0 0 24 24"
126
+ stroke= " currentColor"
115
127
>
128
+ < path
129
+ stroke- linecap= " round"
130
+ stroke- linejoin= " round"
131
+ stroke- width= " 2"
132
+ d= " M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l-1.586-1.586a2 2 0 00-2.828 0L6 18"
133
+ / >
134
+ < / svg>
135
+ < / div>
136
+ < / div>
137
+ < div class = " p-6" >
138
+ < h2
139
+ class = " text-xl font-semibold text-slate-800 dark:text-slate-100"
140
+ >
141
+ {{ article .children [0 ]? .meta ? .title }}
142
+ < / h2>
143
+ < p class = " mt-2 text-sm text-slate-600 dark:text-slate-400" >
144
+ {{ article .children [0 ]? .meta ? .description }}
145
+ < / p>
146
+ < div class = " mt-4 flex items-center justify-between" >
147
+ < time class = " text-xs text-slate-500 dark:text-slate-400" >
116
148
{{ article .children [0 ]? .meta ? .date }}
117
149
< / time>
118
- < / article>
150
+ < div
151
+ class = " flex items-center text-sm font-medium text-sky-500"
152
+ >
153
+ Read article
154
+ < svg
155
+ viewBox= " 0 0 16 16"
156
+ fill= " none"
157
+ aria- hidden= " true"
158
+ class = " ml-1 h-4 w-4 stroke-current"
159
+ >
160
+ < path
161
+ d= " M6.75 5.75 9.25 8l-2.5 2.25"
162
+ stroke- width= " 1.5"
163
+ stroke- linecap= " round"
164
+ stroke- linejoin= " round"
165
+ / >
166
+ < / svg>
167
+ < / div>
168
+ < / div>
119
169
< / div>
120
- < / div>
121
-
122
- < subscription- form class = " mt-12" / >
123
- < the- footer / >
170
+ < / router- link>
124
171
< / div>
125
172
< / template>
126
173
0 commit comments