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

59 lines
1015 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 17:37:49 -07:00
/**
* The color of this embed, undefined
* for no custom color.
* // TODO: make this work lol
2024-04-17 17:37:49 -07:00
*/
color?: string | undefined;
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,
2024-04-17 17:37:49 -07:00
color,
2024-04-17 16:14:10 -07:00
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;