mirror of
https://github.com/usatiuk/photos.git
synced 2025-10-28 15:27:49 +01:00
click on blank space closes image
This commit is contained in:
@@ -85,13 +85,11 @@ export const OverviewComponent: React.FunctionComponent<
|
||||
);
|
||||
const photosEls = photos.map((photo) => {
|
||||
return (
|
||||
<>
|
||||
<PhotoCard
|
||||
key={photo.id}
|
||||
photo={photo}
|
||||
onClick={() => onCardClick(photo.id)}
|
||||
/>
|
||||
</>
|
||||
<PhotoCard
|
||||
key={photo.id}
|
||||
photo={photo}
|
||||
onClick={() => onCardClick(photo.id)}
|
||||
/>
|
||||
);
|
||||
});
|
||||
return [
|
||||
@@ -144,7 +142,12 @@ export const OverviewComponent: React.FunctionComponent<
|
||||
>
|
||||
<div id="photoOverlayContainer">
|
||||
<div id="photo">
|
||||
<Photo id={selectedPhoto} />
|
||||
<Photo
|
||||
id={selectedPhoto}
|
||||
close={() => {
|
||||
setOverlayOpen(false);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<div id="photoOverlayDrawer">
|
||||
<Button
|
||||
|
||||
@@ -20,22 +20,18 @@ export interface IPhotoComponentProps {
|
||||
photoState: IPhotoState | undefined;
|
||||
|
||||
fetchPhoto: (id: number) => void;
|
||||
close: () => void;
|
||||
}
|
||||
|
||||
export const PhotoComponent: React.FunctionComponent<IPhotoComponentProps> = (
|
||||
props,
|
||||
) => {
|
||||
const [
|
||||
smallPreviewFetching,
|
||||
setSmallPreviewFetching,
|
||||
] = React.useState<boolean>(false);
|
||||
const [
|
||||
largePreviewFetching,
|
||||
setLargePreviewFetching,
|
||||
] = React.useState<boolean>(false);
|
||||
const [originalFetching, setOriginalFetching] = React.useState<boolean>(
|
||||
false,
|
||||
);
|
||||
const [smallPreviewFetching, setSmallPreviewFetching] =
|
||||
React.useState<boolean>(false);
|
||||
const [largePreviewFetching, setLargePreviewFetching] =
|
||||
React.useState<boolean>(false);
|
||||
const [originalFetching, setOriginalFetching] =
|
||||
React.useState<boolean>(false);
|
||||
|
||||
const [smallPreview, setSmallPreview] = React.useState<string | null>(null);
|
||||
const [largePreview, setLargePreview] = React.useState<string | null>(null);
|
||||
@@ -97,7 +93,13 @@ export const PhotoComponent: React.FunctionComponent<IPhotoComponentProps> = (
|
||||
return (
|
||||
<>
|
||||
{fileExists ? (
|
||||
<div id="photoView">
|
||||
<div
|
||||
id="photoView"
|
||||
onClick={(e: React.MouseEvent) => {
|
||||
if ((e.target as HTMLElement).tagName !== "IMG")
|
||||
props.close();
|
||||
}}
|
||||
>
|
||||
<img
|
||||
ref={imgRef}
|
||||
id="photoImg"
|
||||
|
||||
Reference in New Issue
Block a user