@@ -24,11 +24,11 @@ export const CARD_IMAGE_HEIGHT = 230
24
24
25
25
interface CardWithMetaDataProps {
26
26
isFluid ?: boolean
27
- href : string
27
+ href : string | null | undefined
28
28
imageURL : string | null | undefined
29
- title : string
30
- subtitle : string
31
- tag : string
29
+ title : string | null | undefined
30
+ subtitle : string | null | undefined
31
+ tag : string | null | undefined
32
32
onPress ?: ( event : GestureResponderEvent ) => void
33
33
testId ?: string
34
34
}
@@ -41,39 +41,39 @@ export const CardWithMetaData: React.FC<CardWithMetaDataProps> = (props) => {
41
41
const { width } = useWindowDimensions ( )
42
42
43
43
return (
44
- < >
45
- < Flex width = { isFluid ? "100%" : CARD_IMAGE_WIDTH } >
46
- < RouterLink onPress = { onPress } testID = "article-card" to = { href } >
47
- < Flex width = { isFluid ? "100%" : CARD_IMAGE_WIDTH } overflow = "hidden" >
48
- { ! ! imageURL &&
49
- ( isFluid ? (
50
- < Image
51
- src = { imageURL }
52
- // aspect ratio is fixed to 1.33 to match the old image aspect ratio
53
- aspectRatio = { 1.33 }
54
- width = { width / numColumns - 2 * space ( 2 ) }
55
- />
56
- ) : (
57
- < Image src = { imageURL } width = { CARD_IMAGE_WIDTH } height = { CARD_IMAGE_HEIGHT } />
58
- ) ) }
59
- < Spacer y = { 1 } />
44
+ < Flex width = { isFluid ? "100%" : CARD_IMAGE_WIDTH } >
45
+ < RouterLink onPress = { onPress } testID = "article-card" to = { href } >
46
+ < Flex width = { isFluid ? "100%" : CARD_IMAGE_WIDTH } overflow = "hidden" >
47
+ { ! ! imageURL &&
48
+ ( isFluid ? (
49
+ < Image
50
+ src = { imageURL }
51
+ // aspect ratio is fixed to 1.33 to match the old image aspect ratio
52
+ aspectRatio = { 1.33 }
53
+ width = { width / numColumns - 2 * space ( 2 ) }
54
+ />
55
+ ) : (
56
+ < Image src = { imageURL } width = { CARD_IMAGE_WIDTH } height = { CARD_IMAGE_HEIGHT } />
57
+ ) ) }
58
+ < Spacer y = { 1 } />
59
+ { ! ! title && (
60
60
< Text numberOfLines = { 2 } ellipsizeMode = "tail" variant = "sm-display" mb = { 0.5 } >
61
61
{ title }
62
62
</ Text >
63
- { ! ! subtitle && (
64
- < Text color = "black60" variant = "xs" >
65
- { subtitle }
66
- </ Text >
67
- ) }
68
- { ! ! tag && (
69
- < Text color = "black100" variant = "xs" >
70
- { tag }
71
- </ Text >
72
- ) }
73
- </ Flex >
74
- </ RouterLink >
75
- </ Flex >
76
- </ >
63
+ ) }
64
+ { ! ! subtitle && (
65
+ < Text color = "black60" variant = "xs" >
66
+ { subtitle }
67
+ </ Text >
68
+ ) }
69
+ { ! ! tag && (
70
+ < Text color = "black100" variant = "xs" >
71
+ { tag }
72
+ </ Text >
73
+ ) }
74
+ </ Flex >
75
+ </ RouterLink >
76
+ </ Flex >
77
77
)
78
78
}
79
79
0 commit comments