fui-fancyui
Version:
FancyUI Libary
28 lines (27 loc) • 767 B
JavaScript
"use client";
import { jsx as n } from "react/jsx-runtime";
import { useRef as a, useEffect as c } from "react";
import { styled as s } from "styled-components";
function y(e) {
const { isOpen: r, onClick: i, externalStyle: o } = e, t = a(null);
return c(() => {
r ? requestAnimationFrame(() => {
t.current && (t.current.style.opacity = "0.5");
}) : t.current && (t.current.style.opacity = "0");
}, [r]), /* @__PURE__ */ n(f, { ref: t, onClick: i, $externalStyle: o });
}
const f = s.div`
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.5);
z-index: 99;
opacity: 0; // Start with opacity 0
transition: opacity 0.3s ease 0s;
${({ $externalStyle: e }) => e}
`;
export {
y as default
};