From fb49d677bed5da1b8fb949dc1173418ace48b5cf Mon Sep 17 00:00:00 2001 From: "MD. MOHIBUR RAHMAN" <35300157+mrpmohiburrahman@users.noreply.github.com> Date: Sun, 23 Jun 2024 05:55:12 +0600 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20show=20full=20animation=20on=20full?= =?UTF-8?q?=20screen=20modal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/gallery/Gallery.module.css | 50 ++++++++++ components/gallery/Gallery.tsx | 126 +++++++++++++++++--------- package.json | 1 + pnpm-lock.yaml | 36 ++++++++ 4 files changed, 172 insertions(+), 41 deletions(-) diff --git a/components/gallery/Gallery.module.css b/components/gallery/Gallery.module.css index 7ffb053..b1e06f7 100644 --- a/components/gallery/Gallery.module.css +++ b/components/gallery/Gallery.module.css @@ -42,6 +42,7 @@ flex-direction: column; height: 350px; transition: background 0.3s ease; + /* Removed cursor: pointer; */ } .videoContainer { @@ -51,6 +52,8 @@ padding-top: 56.25%; /* 16:9 Aspect Ratio */ overflow: hidden; + cursor: pointer; + /* Added cursor: pointer; */ } .cardContent { @@ -76,6 +79,8 @@ .icon { font-size: 1.2rem; color: var(--icon-color); + cursor: pointer; + /* Added cursor: pointer; */ } .source { @@ -90,8 +95,53 @@ border-radius: 4px; font-size: 0.9rem; transition: background 0.3s ease; + cursor: pointer; + /* Added cursor: pointer; */ } .sourceButton:hover { background: darken(var(--button-background), 10%); +} + +.modal { + position: fixed; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + height: 100vh; + width: auto; + max-width: 90%; + background: #000; + outline: none; + border: none; + border-radius: 8px; + overflow: hidden; + z-index: 1001; + display: flex; + justify-content: center; + align-items: center; +} + +.overlay { + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + background: rgba(0, 0, 0, 0.8); + z-index: 1000; +} + +.modalContent { + display: flex; + align-items: center; + justify-content: center; + width: 100%; + height: 100%; +} + +.fullscreenVideo { + max-height: 100%; + width: auto; + max-width: 100%; } \ No newline at end of file diff --git a/components/gallery/Gallery.tsx b/components/gallery/Gallery.tsx index ca23cd9..5325d39 100644 --- a/components/gallery/Gallery.tsx +++ b/components/gallery/Gallery.tsx @@ -1,59 +1,103 @@ // src/components/gallery/Gallery.js -import React from "react"; +import React, { useState } from "react"; import styles from "./Gallery.module.css"; import Video from "../video/Video"; -import useBaseUrl from "@docusaurus/useBaseUrl"; import { FaTwitter, FaLinkedin, FaGlobe } from "react-icons/fa"; +import Modal from "react-modal"; +import useBaseUrl from "@docusaurus/useBaseUrl"; + +Modal.setAppElement("#__docusaurus"); const Gallery = ({ items }) => { + const [modalIsOpen, setModalIsOpen] = useState(false); + const [currentVideoUrl, setCurrentVideoUrl] = useState(""); + + const openModal = (url) => { + setCurrentVideoUrl(url); + setModalIsOpen(true); + }; + + const closeModal = () => { + setModalIsOpen(false); + setCurrentVideoUrl(""); + }; + return (