mirror of
https://github.com/Zagrios/bs-manager.git
synced 2026-07-03 14:08:25 +02:00
create iframe view and fix preview map
This commit is contained in:
@@ -222,11 +222,6 @@ export const MapItem = memo(({hash, title, autor, songAutor, coverUrl, songUrl,
|
||||
}, areEqual)
|
||||
|
||||
function areEqual(prevProps: MapItemProps, nextProps: MapItemProps): boolean {
|
||||
Array.from(Object.entries(prevProps)).forEach(v => {
|
||||
if(!equal(prevProps[v[0]], nextProps[v[0]])){
|
||||
console.log(v[0]);
|
||||
}
|
||||
});
|
||||
return equal(prevProps, nextProps);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
import { ModalComponent } from "renderer/services/modale.service"
|
||||
|
||||
export const IframeModal: ModalComponent<void, string> = ({resolver, data}) => {
|
||||
return (
|
||||
<div className="w-[calc(100vw-250px)] h-[calc(100vh-250px)]">
|
||||
<iframe className="w-full h-full" src={data}></iframe>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import { AnimatePresence, motion } from "framer-motion";
|
||||
import { useRef } from "react";
|
||||
import { useClickOutside } from "renderer/hooks/use-click-outside.hook";
|
||||
import { useObservable } from "renderer/hooks/use-observable.hook"
|
||||
import { LinkOpenerService } from "renderer/services/link-opener.service";
|
||||
|
||||
export function BsmIframeView() {
|
||||
|
||||
const linkService = LinkOpenerService.getInstance()
|
||||
|
||||
const iframeUrl = useObservable(linkService.iframeLink$);
|
||||
const ref = useRef(null);
|
||||
useClickOutside(ref, () => linkService.closeIframe());
|
||||
|
||||
return (
|
||||
<AnimatePresence>
|
||||
{iframeUrl && (
|
||||
<div className="top-0 absolute w-screen h-screen flex content-center items-center justify-center z-50">
|
||||
<motion.span className="absolute w-full h-full bg-black top-0 right-0" initial={{opacity: 0}} animate={{opacity: .60}} exit={{opacity: 0}} transition={{duration: .2}}/>
|
||||
<motion.div ref={ref} className="z-[1] w-[calc(100vw-250px)] h-[calc(100vh-250px)] shadow-black shadow-md rounded-md overflow-hidden bg-black" initial={{y: "100vh"}} animate={{y: 0}} exit={{y: "100vh"}}>
|
||||
<iframe className="w-full h-full" src={iframeUrl}/>
|
||||
</motion.div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
</AnimatePresence>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user