Skip to content

Commit

Permalink
Merge pull request #156 from Its-Just-Nans/fix-cover
Browse files Browse the repository at this point in the history
Social Tags: change cover img code
  • Loading branch information
Lissy93 authored Jun 30, 2024
2 parents 9512595 + db242fb commit 67cc4c5
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/web-check-live/components/Results/SocialTags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ const cardStyles = `
}
`;

const OgBanner = ({ ogImage, ogUrl }: { ogImage: string; ogUrl?: string }): JSX.Element => {
const urlCover = ogImage.startsWith("/") && ogUrl ? `${ogUrl}${ogImage}` : ogImage;
return (
<div className="banner-image">
<img src={urlCover} alt="Banner" />
</div>
);
};

const SocialTagsCard = (props: {data: any, title: string, actionButtons: any }): JSX.Element => {
const tags = props.data;
return (
Expand All @@ -36,7 +45,7 @@ const SocialTagsCard = (props: {data: any, title: string, actionButtons: any }):
{ tags.author && <Row lbl="Author" val={tags.author} />}
{ tags.publisher && <Row lbl="Publisher" val={tags.publisher} />}
{ tags.generator && <Row lbl="Generator" val={tags.generator} />}
{ tags.ogImage && <div className="banner-image"><img src={tags.ogImage} alt="Banner" /></div> }
{tags.ogImage && <OgBanner ogImage={tags.ogImage} ogUrl={tags.ogUrl} />}
</Card>
);
}
Expand Down

0 comments on commit 67cc4c5

Please sign in to comment.