import React, { memo, VFC } from 'react'; import classNames from 'classnames'; import { Icon } from '~/components/input/Icon'; import { SeparatedMenu } from '~/components/menu/SeparatedMenu'; import { NodeEditMenu } from '~/components/node/NodeEditMenu'; import { Placeholder } from '~/components/placeholders/Placeholder'; import { getPrettyDate } from '~/utils/dom'; import styles from './styles.module.scss'; interface IProps { id?: number; title: string; username?: string; createdAt: string; likeCount: number; isHeroic: boolean; isLocked: boolean; isLiked: boolean; canEdit: boolean; canLike: boolean; canStar: boolean; isLoading: boolean; onLike: () => void; onStar: () => void; onLock: () => void; onEdit: () => void; } const NodeTitle: VFC = memo( ({ title, username, createdAt, likeCount, isHeroic, isLocked, isLiked, canStar, canEdit, canLike, isLoading, onStar, onLike, onLock, onEdit, }) => { return (
{isLoading ? : title || '...'}
{!!username && ( )}
{canEdit && ( )} {canLike && (
{isLiked ? ( ) : ( )} {!!likeCount && likeCount > 0 && (
{likeCount}
)}
)}
); }, ); export { NodeTitle };