From f38864aea87dda5f96201494d213a4aad595b8a2 Mon Sep 17 00:00:00 2001 From: kazachilo Date: Mon, 17 Mar 2025 12:45:03 +0300 Subject: [PATCH] =?UTF-8?q?=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20=D0=BF=D1=80=D0=BE=D0=B1=D0=BB=D0=B5=D0=BC=D1=8B?= =?UTF-8?q?=20=D1=81=20=D0=BF=D1=80=D0=B5=D0=B4=D0=BF=D1=80=D0=BE=D1=81?= =?UTF-8?q?=D0=BC=D0=BE=D1=82=D1=80=D0=BE=D0=BC=20=D0=B8=D0=B7=D0=BE=D0=B1?= =?UTF-8?q?=D1=80=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8=D0=B9=20=D0=B8=20=D0=B8?= =?UTF-8?q?=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=D1=8B=20=D1=81=D1=82=D0=B8?= =?UTF-8?q?=D0=BB=D0=B8=20=D0=BA=D0=BD=D0=BE=D0=BF=D0=BA=D0=B8=20=D0=B3?= =?UTF-8?q?=D0=B5=D0=BD=D0=B5=D1=80=D0=B0=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/blocks/GenerateButton.module.css | 2 +- src/components/shared/ImageViewer.tsx | 13 +++++++++---- src/screens/Home.module.css | 14 +++++++++----- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/components/blocks/GenerateButton.module.css b/src/components/blocks/GenerateButton.module.css index b1fc4f8..be8dc9a 100644 --- a/src/components/blocks/GenerateButton.module.css +++ b/src/components/blocks/GenerateButton.module.css @@ -2,7 +2,7 @@ width: 100%; max-width: 28rem; margin: 24px auto; - padding: 16px; + padding: 12px; border: none; border-radius: 12px; background: linear-gradient(135deg, #4CAF50, #45A049); diff --git a/src/components/shared/ImageViewer.tsx b/src/components/shared/ImageViewer.tsx index 45afa96..c5565cd 100644 --- a/src/components/shared/ImageViewer.tsx +++ b/src/components/shared/ImageViewer.tsx @@ -17,7 +17,7 @@ const ImageViewer: React.FC = ({ imageUrl, onClose }) => { // Закрытие при клике на фон const handleBackdropClick = (e: React.MouseEvent) => { if (e.target === e.currentTarget) { - onClose(); + handleClose(); } }; @@ -46,7 +46,7 @@ const ImageViewer: React.FC = ({ imageUrl, onClose }) => { const isUpSwipe = distance > minSwipeDistance; if (isUpSwipe) { - onClose(); + handleClose(); } else { // Если свайп не завершен, плавно возвращаем изображение на место setTranslateY(0); @@ -57,11 +57,16 @@ const ImageViewer: React.FC = ({ imageUrl, onClose }) => { setTouchEnd(null); }; + // Функция для закрытия просмотрщика + const handleClose = () => { + onClose(); + }; + // Закрытие при нажатии Escape useEffect(() => { const handleEscKey = (e: KeyboardEvent) => { if (e.key === 'Escape') { - onClose(); + handleClose(); } }; @@ -86,7 +91,7 @@ const ImageViewer: React.FC = ({ imageUrl, onClose }) => { onTouchEnd={handleTouchEnd} >
-