From b9d364005b59a14931f01513b39f07f07855745d Mon Sep 17 00:00:00 2001 From: Filip Czaplicki Date: Thu, 25 Jan 2024 23:54:06 +0100 Subject: [PATCH] refactor: make PhotoGallery React component --- src/components/sidebar/defibrillatorDetails.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/sidebar/defibrillatorDetails.tsx b/src/components/sidebar/defibrillatorDetails.tsx index 468db0a..ff266e6 100644 --- a/src/components/sidebar/defibrillatorDetails.tsx +++ b/src/components/sidebar/defibrillatorDetails.tsx @@ -32,7 +32,11 @@ import DetailTextRow from "./detailTextRow"; import { OpeningHoursField } from "./openingHours"; import { CheckDateField } from "./verificationDate"; -function photoGallery(data: DefibrillatorData, closeSidebar: () => void) { +const PhotoGallery: FC = ({ + data, + closeSidebar, +}) => { + if (data === null) return null; const { t } = useTranslation(); const { authState: { auth }, @@ -112,7 +116,7 @@ function photoGallery(data: DefibrillatorData, closeSidebar: () => void) {
); -} +}; const DefibrillatorDetails: FC = (props) => { const { t } = useTranslation(); @@ -158,7 +162,7 @@ const DefibrillatorDetails: FC = (props) => { - {photoGallery(data, closeSidebar)} +