Skip to content

Commit c2e26a2

Browse files
committed
chore: adjust types
1 parent ba0dfca commit c2e26a2

File tree

1 file changed

+34
-34
lines changed

1 file changed

+34
-34
lines changed

src/app/Components/Cards/CardWithMetaData.tsx

+34-34
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ export const CARD_IMAGE_HEIGHT = 230
2424

2525
interface CardWithMetaDataProps {
2626
isFluid?: boolean
27-
href: string
27+
href: string | null | undefined
2828
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
3232
onPress?: (event: GestureResponderEvent) => void
3333
testId?: string
3434
}
@@ -41,39 +41,39 @@ export const CardWithMetaData: React.FC<CardWithMetaDataProps> = (props) => {
4141
const { width } = useWindowDimensions()
4242

4343
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 && (
6060
<Text numberOfLines={2} ellipsizeMode="tail" variant="sm-display" mb={0.5}>
6161
{title}
6262
</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>
7777
)
7878
}
7979

0 commit comments

Comments
 (0)