mirror of
https://github.com/D4M13N-D3V/comissions-app-ui.git
synced 2025-03-13 07:45:07 +00:00
48 lines
1.5 KiB
TypeScript
48 lines
1.5 KiB
TypeScript
import * as React from 'react';
|
|
import ImageList from '@mui/material/ImageList';
|
|
import ImageListItem from '@mui/material/ImageListItem';
|
|
import { useEffect, useState } from "react";
|
|
import DeleteIcon from '@mui/icons-material/Delete';
|
|
|
|
import { CircularProgress, ImageListItemBar } from '@mui/material';
|
|
|
|
import { IconButton } from '@mui/material';
|
|
|
|
const EditableArtistPortfolioImage = ({artistId,itemId,reload}) => {
|
|
const [loaded, setLoaded] = useState(false);
|
|
const [deleting, setDeleting] = useState(false);
|
|
const handleImageLoaded = () => {
|
|
setLoaded(true);
|
|
};
|
|
|
|
|
|
const deleteButton = () => {
|
|
setDeleting(true);
|
|
fetch('/api/artist/portfolio/'+itemId+"/delete", {
|
|
method: 'DELETE'
|
|
}).then(response => {
|
|
reload().then(data => {
|
|
})
|
|
})
|
|
}
|
|
|
|
return (
|
|
<ImageListItem key={itemId }>
|
|
<img
|
|
srcSet={process.env.NEXT_PUBLIC_API_URL+`/api/Discovery/Artists/${artistId}/Portfolio/${itemId}`}
|
|
src={process.env.NEXT_PUBLIC_API_URL+`/api/Discovery/Artists/${artistId}/Portfolio/${itemId}`}
|
|
alt={itemId}
|
|
loading="lazy"
|
|
style={{ filter: loaded ? 'blur(0)' : 'blur(10px)', backgroundColor:'grey' }}
|
|
onLoad={handleImageLoaded}
|
|
/>
|
|
<ImageListItemBar
|
|
actionIcon={
|
|
<IconButton onClick={deleteButton} color="error" >
|
|
<DeleteIcon />
|
|
</IconButton>
|
|
}>
|
|
</ImageListItemBar>
|
|
</ImageListItem>)
|
|
}
|
|
export default EditableArtistPortfolioImage |