Skip to content

Commit

Permalink
front: displays button when an image is selected
Browse files Browse the repository at this point in the history
  • Loading branch information
theocrsb authored and SharglutDev committed Jul 8, 2024
1 parent b05d26f commit fc1b9e9
Showing 1 changed file with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type PictureUploaderProps = {

type PicturePlaceholderButtonsProps = {
setTempProjectImage: (tempProjectImage: Blob | null | undefined) => void;
tempProjectImage: Blob | null | undefined;
safeWord: string;
t: TFunction;
};
Expand Down Expand Up @@ -88,6 +89,7 @@ function PicturePlaceholder({ image, isValid, tempProjectImage }: PicturePlaceho

function PicturePlaceholderButtons({
setTempProjectImage,
tempProjectImage,
safeWord,
t,
}: PicturePlaceholderButtonsProps) {
Expand Down Expand Up @@ -183,14 +185,17 @@ function PicturePlaceholderButtons({
>
<img src={logoSNCF} alt="SNCF LOGO" />
</button>
<button
className="remove"
type="button"
aria-label={t('removeImage')}
onClick={() => setTempProjectImage(null)}
>
<XCircle variant="fill" />
</button>

{tempProjectImage && (
<button
className="remove"
type="button"
aria-label={t('removeImage')}
onClick={() => setTempProjectImage(null)}
>
<XCircle variant="fill" />
</button>
)}
</div>
);
}
Expand Down Expand Up @@ -247,6 +252,7 @@ export default function PictureUploader({
</label>
<PicturePlaceholderButtons
setTempProjectImage={setTempProjectImage}
tempProjectImage={tempProjectImage}
safeWord={safeWord}
t={t}
/>
Expand Down

0 comments on commit fc1b9e9

Please sign in to comment.