import Image from "next/image";
export function replaceWithImageTags(index, str, emoji_path) {
if (index % 2 === 0) {
return
{`${str}`}
;
} else {
return (
<>
>
);
}
}
export function formatCustomEmoji(str, emoji_paths) {
const emoji_pattern = new RegExp(/(:[A-Za-z_-]+:)/, "g");
const values = emoji_pattern[Symbol.split](str);
if (Boolean(emoji_paths)) {
return (
<>
{values.map((v, i) =>
replaceWithImageTags(i, v, emoji_paths[v])
)}
>
);
} else {
return <>>;
}
}
export function renderPossibleInfo(info, emoji_paths) {
if (Boolean(info)) {
let infoarray = info.split("\n");
infoarray = infoarray.slice(0, infoarray.length - 1);
return infoarray.map((line) => (
{line == "" ? (
) : (
formatCustomEmoji(line, emoji_paths)
)}
));
} else {
return <>>;
}
}
export default function introductionCard({ introduction, emoji_paths }) {
return (
{renderPossibleInfo(introduction, emoji_paths)}
);
}