RESTfulMC/Frontend/src/app/components/embed.tsx

51 lines
850 B
TypeScript
Raw Normal View History

2024-04-16 17:23:09 -07:00
import { Metadata } from "next";
2024-04-17 16:14:10 -07:00
/**
* Props for an embed.
*/
2024-04-16 17:23:09 -07:00
type EmbedProps = {
2024-04-17 16:14:10 -07:00
/**
* The title of the embed.
*/
title: string;
2024-04-16 17:23:09 -07:00
2024-04-17 16:14:10 -07:00
/**
* The description of the embed.
*/
description: string;
2024-04-16 17:23:09 -07:00
2024-04-17 16:14:10 -07:00
/**
* The optional thumbnail image of the embed.
*/
thumbnail?: string;
2024-04-16 17:23:09 -07:00
};
/**
* An embed for a page.
*
* @param props the embed props
* @returns the embed jsx
*/
const Embed = ({
2024-04-17 16:14:10 -07:00
title,
description,
thumbnail = "",
2024-04-16 17:23:09 -07:00
}: EmbedProps): Metadata => {
2024-04-17 16:14:10 -07:00
return {
title: title,
openGraph: {
title: `${title}`,
description: description,
images: [
{
url: thumbnail,
},
],
},
twitter: {
card: "summary",
},
};
2024-04-16 17:23:09 -07:00
};
export default Embed;