diff --git a/src/routes/home/components/cobe.tsx b/src/routes/home/components/cobe.tsx index faa35e8..4c8e1ff 100644 --- a/src/routes/home/components/cobe.tsx +++ b/src/routes/home/components/cobe.tsx @@ -1,10 +1,12 @@ import type { SVGProps } from 'react'; -import { useEffect, useRef } from 'react'; +import { useEffect, useRef, useState } from 'react'; import createGlobe from 'cobe'; import { useSpring } from 'react-spring'; import { useTranslation } from 'react-i18next'; +import VideoPlayer from './videoPlayer.tsx'; + import { SlackWhiteIcon, DiscordIcon, @@ -13,8 +15,6 @@ import { YoutubeIcon, } from '@/components/icons'; -import { siteConfig } from '@/config'; - export const TextLogo = (props: SVGProps) => ( ) => ( ); export const Cobe = () => { + const [showPopup, setShowPopup] = useState(false); // eslint-disable-next-line @typescript-eslint/no-explicit-any const canvasRef = useRef(); const pointerInteracting = useRef(0); @@ -40,6 +41,11 @@ export const Cobe = () => { })); const { t } = useTranslation(); + const handleClosePopup = () => { + setShowPopup(!showPopup); + console.log('~showPopup:', showPopup); + }; + useEffect(() => { let phi = 0; let width = 0; @@ -87,10 +93,10 @@ export const Cobe = () => { position: 'relative', display: 'block', }} - href={siteConfig.links.bilibili} - target="_blank" > + {showPopup && }
{ + const handleCloseClick = (e) => { + // 确保点击的是背景层而不是播放器内部 + if (e.target === e.currentTarget) { + onClose(); + } + }; + + return ReactDOM.createPortal( +
+
+ +
+
, + document.body, + ); +}; + +export default VideoPlayer;