forked from github/plane
fix: delete image preview after modal close (#511)
This commit is contained in:
parent
6962d7718f
commit
19434342d3
@ -14,7 +14,7 @@ import { PrimaryButton, SecondaryButton } from "components/ui";
|
||||
// icons
|
||||
import { UserCircleIcon } from "components/icons";
|
||||
|
||||
type TImageUploadModalProps = {
|
||||
type Props = {
|
||||
value?: string | null;
|
||||
onClose: () => void;
|
||||
isOpen: boolean;
|
||||
@ -22,7 +22,7 @@ type TImageUploadModalProps = {
|
||||
userImage?: boolean;
|
||||
};
|
||||
|
||||
export const ImageUploadModal: React.FC<TImageUploadModalProps> = ({
|
||||
export const ImageUploadModal: React.FC<Props> = ({
|
||||
value,
|
||||
onSuccess,
|
||||
isOpen,
|
||||
@ -59,6 +59,7 @@ export const ImageUploadModal: React.FC<TImageUploadModalProps> = ({
|
||||
const imageUrl = res.asset;
|
||||
onSuccess(imageUrl);
|
||||
setIsImageUploading(false);
|
||||
setImage(null);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
@ -70,6 +71,7 @@ export const ImageUploadModal: React.FC<TImageUploadModalProps> = ({
|
||||
const imageUrl = res.asset;
|
||||
onSuccess(imageUrl);
|
||||
setIsImageUploading(false);
|
||||
setImage(null);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
@ -77,6 +79,7 @@ export const ImageUploadModal: React.FC<TImageUploadModalProps> = ({
|
||||
};
|
||||
|
||||
const handleClose = () => {
|
||||
setImage(null);
|
||||
onClose();
|
||||
};
|
||||
|
||||
|
@ -19,14 +19,14 @@ export const LinearProgressIndicator: React.FC<Props> = ({ data }) => {
|
||||
|
||||
return (
|
||||
<Tooltip key={item.id} tooltipContent={`${item.name} ${Math.round(item.value)}%`}>
|
||||
<div className="bar" style={style} />
|
||||
<div style={style} />
|
||||
</Tooltip>
|
||||
);
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="flex h-1 w-full items-center justify-between gap-1">
|
||||
{total === 0 ? " - 0%" : <div className="flex h-full w-full gap-1 rounded-md">{bars}</div>}
|
||||
<div className="flex h-1 w-full items-center justify-between gap-1">
|
||||
{total === 0 ? " - 0%" : <div className="flex h-full w-full gap-1">{bars}</div>}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user