import type { FC } from '../../lib/teact/teact'; import { memo } from '../../lib/teact/teact'; import type { ThreadId } from '../../types'; import { GENERAL_TOPIC_ID } from '../../config'; import buildClassName from '../../util/buildClassName'; import { getTopicDefaultIcon } from '../../util/forumColors'; import { getFirstLetters } from '../../util/textFormat'; import renderText from './helpers/renderText'; import Icon from './icons/Icon'; import styles from './TopicDefaultIcon.module.scss'; type OwnProps = { className?: string; letterClassName?: string; topicId: ThreadId; iconColor?: number; title: string; onClick?: NoneToVoidFunction; }; const TopicDefaultIcon: FC = ({ className, letterClassName, topicId, iconColor, title, onClick, }) => { const iconSrc = getTopicDefaultIcon(iconColor); if (topicId === GENERAL_TOPIC_ID) { return ( ); } return (
{renderText(getFirstLetters(title, 1))}
); }; export default memo(TopicDefaultIcon);