import PropTypes from 'prop-types'; import { useState, useCallback } from 'react'; import { FormattedMessage } from 'react-intl'; import classNames from 'classnames'; import { Blurhash } from 'mastodon/components/blurhash'; import { RelativeTimestamp } from 'mastodon/components/relative_timestamp'; import { ShortNumber } from 'mastodon/components/short_number'; import { Skeleton } from 'mastodon/components/skeleton'; import { AuthorLink } from './author_link'; const sharesCountRenderer = (displayNumber, pluralReady) => ( {displayNumber}, }} /> ); export const Story = ({ url, title, lang, publisher, publishedAt, author, authorAccount, sharedTimes, thumbnail, thumbnailDescription, blurhash, expanded }) => { const [thumbnailLoaded, setThumbnailLoaded] = useState(false); const handleImageLoad = useCallback(() => { setThumbnailLoaded(true); }, [setThumbnailLoaded]); return (
{publisher ? {publisher} : }{publishedAt && <> ยท }
{title ? title : }
{author ? : {author} }} /> : } {typeof sharedTimes === 'number' ? : }
{thumbnail ? ( <>
{thumbnailDescription} ) : }
); }; Story.propTypes = { url: PropTypes.string, title: PropTypes.string, lang: PropTypes.string, publisher: PropTypes.string, publishedAt: PropTypes.string, author: PropTypes.string, authorAccount: PropTypes.string, sharedTimes: PropTypes.number, thumbnail: PropTypes.string, thumbnailDescription: PropTypes.string, blurhash: PropTypes.string, expanded: PropTypes.bool, };