Refactor ImageModal component for improved layout and responsiveness

- Updated ImageModal styles to include overflow handling and a maximum height for better usability.
- Adjusted the structure to place the enlarged image at the top, enhancing visual presentation.
- Removed the redundant image container to streamline the component.
This commit is contained in:
2025-06-07 17:29:04 +02:00
parent d1591d1970
commit 4321824bf5
3 changed files with 12 additions and 19 deletions

View File

@@ -16,7 +16,8 @@
<!-- Modal container with animation --> <!-- Modal container with animation -->
<div <div
id="modal-container" id="modal-container"
class="fixed top-1/2 left-1/2 z-60 max-w-4xl w-full p-4 transform -translate-x-1/2 -translate-y-1/2 scale-95 transition-all duration-300 ease-in-out flex flex-col items-center" class="fixed top-1/2 left-1/2 z-60 max-w-4xl w-full p-4 transform -translate-x-1/2 -translate-y-1/2 scale-95 transition-all duration-300 ease-in-out flex flex-col items-center overflow-y-auto"
style="max-height: 90vh;"
> >
<!-- Close button --> <!-- Close button -->
<button <button
@@ -35,21 +36,14 @@
</svg> </svg>
</button> </button>
<!-- Image container --> <!-- Enlarged Image at the Top -->
<div
class="bg-white dark:bg-gray-800 rounded-lg shadow-xl overflow-hidden flex flex-col justify-center items-center"
style="min-height: 350px; max-height: 75vh; min-width: 320px;"
>
<div class="flex flex-1 items-center justify-center w-full min-h-[250px]" style="height: 100%;">
<img <img
id="modal-image" id="modal-image"
src="" src=""
alt="Enlarged certificate" alt="Enlarged certificate"
class="w-auto object-contain max-h-[60vh]" class="w-auto object-contain max-h-[60vh] mb-4 mx-auto"
style="vertical-align: middle;" style="vertical-align: middle;"
/> />
</div>
</div>
<!-- Caption --> <!-- Caption -->
<div id="modal-caption" class="mt-2 text-center text-white text-lg font-medium"></div> <div id="modal-caption" class="mt-2 text-center text-white text-lg font-medium"></div>

View File

@@ -123,9 +123,6 @@ const {
} }
</div> </div>
{/* Include the image modal component */}
<ImageModal />
{ {
callToAction && ( callToAction && (
<div class="flex justify-center mx-auto w-fit mt-8 font-medium"> <div class="flex justify-center mx-auto w-fit mt-8 font-medium">

View File

@@ -16,6 +16,7 @@ import LanguagePersistence from '~/components/LanguagePersistence.astro';
import GlobalBackground from '~/components/ui/GlobalBackground.astro'; import GlobalBackground from '~/components/ui/GlobalBackground.astro';
import CookieBanner from '~/components/CookieBanner.astro'; import CookieBanner from '~/components/CookieBanner.astro';
import BackToTop from '~/components/ui/BackToTop.astro'; import BackToTop from '~/components/ui/BackToTop.astro';
import ImageModal from '~/components/ui/ImageModal.astro';
// Comment the line below to disable View Transitions // Comment the line below to disable View Transitions
import { ClientRouter } from 'astro:transitions'; import { ClientRouter } from 'astro:transitions';
@@ -83,5 +84,6 @@ const { language, textDirection } = I18N;
})(window, document, 'script', 'https://chat.365devnet.eu/livechat'); })(window, document, 'script', 'https://chat.365devnet.eu/livechat');
</script> </script>
<!-- End of Rocket.Chat Livechat Script --> <!-- End of Rocket.Chat Livechat Script -->
<ImageModal />
</body> </body>
</html> </html>