File tree 3 files changed +254
-25
lines changed
3 files changed +254
-25
lines changed Original file line number Diff line number Diff line change 34
34
"dependencies" : {
35
35
"@amplitude/analytics-browser" : " ^2.11.9" ,
36
36
"@nais/ds-svelte-community" : " ^0.7.5" ,
37
+ "date-fns" : " ^4.1.0" ,
37
38
"svelte-preprocess" : " ^6.0.3"
38
39
}
39
40
}
Original file line number Diff line number Diff line change 1
1
<script lang =" ts" >
2
+ import { format } from " date-fns" ;
2
3
import type { PageData } from " ./$types" ;
3
4
4
5
let { data }: { data: PageData } = $props ();
5
-
6
6
</script >
7
7
8
- {#each data .posts as post }
9
- <a href =" {post .route }" ><h1 >{post .metadata .title }</h1 ></a >
10
- <p >{post .metadata .description }</p >
11
- {/each }
8
+ <ul class =" list" >
9
+ {#each data .posts as post }
10
+ <li class =" item" >
11
+ <a class ="link" href ={post .route }>
12
+ <h2 class ="heading" >{post .metadata .title }</h2 >
13
+ </a >
14
+ <p class ="description" >{post .metadata .description }</p >
15
+ <p >{format (post .metadata .date , " MMMM d, yyyy" )}</p >
16
+ </li >
17
+ {/each }
18
+ </ul >
19
+
20
+ <style >
21
+ .list {
22
+ list-style : none ;
23
+ padding : min (4vw , 3.6rem );
24
+ max-width : 67ch ;
25
+ margin-inline : auto ;
26
+ display : flex ;
27
+ flex-direction : column ;
28
+ gap : 2rem ;
29
+ }
30
+ .link {
31
+ display : inline-block ;
32
+ color : var (--color-primary );
33
+ }
34
+ .link :hover {
35
+ text-decoration : none ;
36
+ }
37
+ .item {
38
+ display : grid ;
39
+ gap : 0.2rem ;
40
+ }
41
+ .description {
42
+ font-size : 1.2rem ;
43
+ }
44
+ </style >
You can’t perform that action at this time.
0 commit comments