bb-plane-fork/web/helpers/emoji.helper.tsx
Prateek Shourya 2014400bed
refactor: move web utils to packages (#7145)
* refactor: move web utils to packages

* fix: build and lint errors

* chore: update drag handle plugin

* chore: update table cell type to fix build errors

* fix: build errors

* chore: sync few changes

* fix: build errors

* chore: minor fixes related to duplicate assets imports

* fix: build errors

* chore: minor changes
2025-06-16 17:18:41 +05:30

23 lines
617 B
TypeScript

/**
* Renders an emoji or icon
* @param {string | { name: string; color: string }} emoji - The emoji or icon to render
* @returns {React.ReactNode} The rendered emoji or icon
*/
export const renderEmoji = (
emoji:
| string
| {
name: string;
color: string;
}
): React.ReactNode => {
if (!emoji) return;
if (typeof emoji === "object")
return (
<span style={{ fontSize: "16px", color: emoji.color }} className="material-symbols-rounded">
{emoji.name}
</span>
);
else return isNaN(parseInt(emoji)) ? emoji : String.fromCodePoint(parseInt(emoji));
};