// @flow import * as React from 'react'; import Card from 'component/common/card'; import ThumbnailMissingImage from './thumbnail-missing.png'; import SelectAsset from 'component/selectAsset'; type Props = { // uploadThumbnailStatus: string, thumbnailParam: string, thumbnailForUri: string, updateThumbnailParam: (string) => void, inline?: boolean, }; const ThumbnailPicker = (props: Props) => { const { thumbnailForUri, thumbnailParam, updateThumbnailParam, inline } = props; // uploadThumbnailStatus // {status === THUMBNAIL_STATUSES.API_DOWN || status === THUMBNAIL_STATUSES.MANUAL ? ( // {status === THUMBNAIL_STATUSES.READY && ( // {status === THUMBNAIL_STATUSES.COMPLETE && thumbnail && ( const [thumbError, setThumbError] = React.useState(false); // possibly existing URL const updateThumb = (thumb: string) => { setThumbError(false); updateThumbnailParam(thumb); }; if (inline) { return (
{thumbError && (
)} {!thumbError && (
{__('Thumbnail { if (thumbnailParam) { setThumbError(true); } }} />
)}
{/* if upload */}
); } return (
{thumbError && (
)} {!thumbError && (
{__('Thumbnail { if (thumbnailParam) { setThumbError(true); } }} />
)}
{/* if upload */}
} />
); }; export default ThumbnailPicker;