File size: 1,042 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
import { forwardRef } from 'react';
import ReaderFeaturedImage from 'calypso/blocks/reader-featured-image';
import AutoDirection from 'calypso/components/auto-direction';
import type { PostItem } from './types';
interface RecentPostFieldProps {
post: PostItem;
}
const RecentPostField = forwardRef< HTMLDivElement, RecentPostFieldProps >( ( { post }, ref ) => {
if ( ! post ) {
return null;
}
return (
<div className="recent-post-field" ref={ ref } role="button" tabIndex={ 0 }>
<AutoDirection>
<div className="recent-post-field__title">
<div className="recent-post-field__title-text">{ post?.title }</div>
<div className="recent-post-field__site-name">{ post?.site_name }</div>
</div>
</AutoDirection>
<div className="recent-post-field__featured-image">
<ReaderFeaturedImage
imageUrl={ post?.featured_image }
imageWidth={ 38 }
imageHeight={ 38 }
isCompactPost
/>
</div>
</div>
);
} );
RecentPostField.displayName = 'RecentPostField';
export default RecentPostField;
|