@@ -28,6 +28,10 @@ export async function RecordCard(
28
28
: null ;
29
29
const target = targetRef ? await context . resolveContentRef ( targetRef ) : null ;
30
30
31
+ const coverIsLandscape =
32
+ cover ?. file ?. dimensions &&
33
+ cover . file ?. dimensions ?. width / cover . file ?. dimensions ?. height > 1 ;
34
+
31
35
const body = (
32
36
< div
33
37
className = { tcls (
@@ -42,17 +46,21 @@ export async function RecordCard(
42
46
'rounded-[7px]' ,
43
47
'straight-corners:rounded-none' ,
44
48
'overflow-hidden' ,
45
- '[&_.heading]:flip-heading-hash' ,
49
+ '[&_.heading>div:first-child]:hidden' ,
50
+ '[&_.heading>div]:text-[.8em]' ,
51
+ 'md:[&_.heading>div]:text-[1em]' ,
46
52
'[&_.blocks:first-child_.heading:first-child_div]:mt-0' , // Remove margin on first heading in card
47
53
48
- cover
49
- ? [
50
- // On mobile, the cover is displayed on the left with 40% of the width
54
+ // On mobile, check if we can display the cover responsively or not:
55
+ // - If the file has a landscape aspect ratio, we display it normally
56
+ // - If the file is square or portrait, we display it left with 40% of the card width
57
+ coverIsLandscape
58
+ ? 'grid-rows-[auto,1fr]'
59
+ : [
51
60
'grid-cols-[40%,_1fr]' ,
52
61
'min-[432px]:grid-cols-none' ,
53
62
'min-[432px]:grid-rows-[auto,1fr]' ,
54
- ]
55
- : null ,
63
+ ] ,
56
64
) }
57
65
>
58
66
{ cover ? (
@@ -74,8 +82,9 @@ export async function RecordCard(
74
82
'w-full' ,
75
83
'h-full' ,
76
84
'object-cover' ,
77
- 'min-[432px]:h-auto' ,
78
- 'min-[432px]:aspect-video' ,
85
+ coverIsLandscape
86
+ ? [ 'h-auto' , 'aspect-video' ]
87
+ : [ 'min-[432px]:h-auto' , 'min-[432px]:aspect-video' ] ,
79
88
) }
80
89
priority = { isOffscreen ? 'lazy' : 'high' }
81
90
preload
0 commit comments