mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-13 07:49:29 +00:00
33 lines
829 B
TypeScript
33 lines
829 B
TypeScript
import { EmojiHTML } from '@/flavours/glitch/components/emoji/html';
|
|
import CheckIcon from '@/material-icons/400-24px/check.svg?react';
|
|
|
|
import type { OnAttributeHandler } from '../utils/html';
|
|
|
|
import { Icon } from './icon';
|
|
|
|
const onAttribute: OnAttributeHandler = (name, value, tagName) => {
|
|
if (name === 'rel' && tagName === 'a') {
|
|
if (value === 'me') {
|
|
return null;
|
|
}
|
|
return [
|
|
name,
|
|
value
|
|
.split(' ')
|
|
.filter((x) => x !== 'me')
|
|
.join(' '),
|
|
];
|
|
}
|
|
return undefined;
|
|
};
|
|
|
|
interface Props {
|
|
link: string;
|
|
}
|
|
export const VerifiedBadge: React.FC<Props> = ({ link }) => (
|
|
<span className='verified-badge'>
|
|
<Icon id='check' icon={CheckIcon} className='verified-badge__mark' />
|
|
<EmojiHTML as='span' htmlString={link} onAttribute={onAttribute} />
|
|
</span>
|
|
);
|