Skip to content

Commit 67cc4c5

Browse files
authored
Merge pull request #156 from Its-Just-Nans/fix-cover
Social Tags: change cover img code
2 parents 9512595 + db242fb commit 67cc4c5

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

‎src/web-check-live/components/Results/SocialTags.tsx‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ const cardStyles = `
1717
}
1818
`;
1919

20+
const OgBanner = ({ ogImage, ogUrl }: { ogImage: string; ogUrl?: string }): JSX.Element => {
21+
const urlCover = ogImage.startsWith("/") && ogUrl ? `${ogUrl}${ogImage}` : ogImage;
22+
return (
23+
<div className="banner-image">
24+
<img src={urlCover} alt="Banner" />
25+
</div>
26+
);
27+
};
28+
2029
const SocialTagsCard = (props: {data: any, title: string, actionButtons: any }): JSX.Element => {
2130
const tags = props.data;
2231
return (
@@ -36,7 +45,7 @@ const SocialTagsCard = (props: {data: any, title: string, actionButtons: any }):
3645
{ tags.author && <Row lbl="Author" val={tags.author} />}
3746
{ tags.publisher && <Row lbl="Publisher" val={tags.publisher} />}
3847
{ tags.generator && <Row lbl="Generator" val={tags.generator} />}
39-
{ tags.ogImage && <div className="banner-image"><img src={tags.ogImage} alt="Banner" /></div> }
48+
{tags.ogImage && <OgBanner ogImage={tags.ogImage} ogUrl={tags.ogUrl} />}
4049
</Card>
4150
);
4251
}

0 commit comments

Comments
 (0)