soapbox/src/components/ui/emoji.tsx

21 wiersze
484 B
TypeScript
Czysty Zwykły widok Historia

2024-11-15 23:52:02 +00:00
interface IEmoji {
/** Unicode emoji character. */
2024-11-15 23:52:02 +00:00
emoji: string;
/** Size to render the emoji. */
size?: number;
2022-04-01 01:32:53 +00:00
}
/** A single emoji image. */
const Emoji: React.FC<IEmoji> = (props): JSX.Element | null => {
2024-11-15 23:52:02 +00:00
const { emoji, size = 16 } = props;
const px = `${size}px`;
2022-04-01 01:32:53 +00:00
return (
2024-11-15 23:52:02 +00:00
<div className='inline-flex items-center justify-center font-emoji leading-[0]' style={{ width: px, height: px, fontSize: px }}>
{emoji}
</div>
2022-04-01 01:32:53 +00:00
);
};
export default Emoji;