import {CloseIcon, ImageIcon, LinkRemovedIcon} from '@sanity/icons' import React, {forwardRef, useState} from 'react' type Props = { isActive?: boolean isDeleted: boolean type: 'collection' | 'product' | 'productVariant' url: string title: string } const ShopifyDocumentStatus = forwardRef((props, ref) => { const {isActive, isDeleted, type, url, title} = props const [imageVisible, setImageVisible] = useState(true) // Hide image on error / 404 const handleImageError = () => setImageVisible(false) return (
{imageVisible && url ? ( {`${title} ) : ( )} {/* Item has been deleted */} {isDeleted ? ( ) : ( <> {/* Products only: item is no longer active */} {type === 'product' && !isActive && ( )} )}
) }) export default ShopifyDocumentStatus