added PreviewCard prop forcedEnable to overrride disable property
This commit is contained in:
parent
4aaebef0e7
commit
6321874ead
2 changed files with 4 additions and 3 deletions
|
@ -23,7 +23,7 @@ function CollectionSelector(props) {
|
|||
collectionLatestFile={item}
|
||||
>
|
||||
<Card>
|
||||
<PreviewCard data={item.file} updateUrl={() => { }}/>
|
||||
<PreviewCard data={item.file} updateUrl={() => { }} forcedEnable />
|
||||
<Card.Text className="text-center">{item.collection.name}</Card.Text>
|
||||
</Card>
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ interface IProps {
|
|||
data: file,
|
||||
updateUrl: (url: string) => void,
|
||||
onClick?: () => void,
|
||||
forcedEnable?: boolean,
|
||||
}
|
||||
|
||||
const Cont = styled.div<{ disabled: boolean }>`
|
||||
|
@ -41,7 +42,7 @@ const Cont = styled.div<{ disabled: boolean }>`
|
|||
|
||||
export default function PreviewCard(props: IProps) {
|
||||
const [imgSrc, setImgSrc] = useState<string>();
|
||||
const { data, onClick, updateUrl } = props;
|
||||
const { data, onClick, updateUrl, forcedEnable } = props;
|
||||
|
||||
useEffect(() => {
|
||||
if (data && !data.msrc) {
|
||||
|
@ -62,7 +63,7 @@ export default function PreviewCard(props: IProps) {
|
|||
}
|
||||
}
|
||||
|
||||
return <Cont onClick={handleClick} disabled={!data?.msrc && !imgSrc}>
|
||||
return <Cont onClick={handleClick} disabled={!forcedEnable && !data?.msrc && !imgSrc}>
|
||||
<img src={data?.msrc || imgSrc} />
|
||||
{data?.metadata.fileType === 1 && <PlayCircleOutline />}
|
||||
</Cont>;
|
||||
|
|
Loading…
Add table
Reference in a new issue