feat: improve

This commit is contained in:
Oleg Proskurin 2025-10-26 18:03:17 +07:00
parent d6a9cd6990
commit b4e5a05ae6
1 changed files with 8 additions and 11 deletions

View File

@ -42,11 +42,9 @@ export const PageProvider = ({
}: PageProviderProps) => {
const [isOpen, setIsOpen] = useState(false);
const [modalContent, setModalContent] = useState<ReactNode | null>(null);
const [scrollPosition, setScrollPosition] = useState(0);
const pathname = usePathname();
const openModal = (content: ReactNode) => {
setScrollPosition(window.scrollY);
setIsOpen(true);
setModalContent(content);
};
@ -54,7 +52,6 @@ export const PageProvider = ({
const closeModal = () => {
setIsOpen(false);
setModalContent(null);
setTimeout(() => window.scrollTo(0, scrollPosition), 0);
};
useEffect(() => {
@ -127,7 +124,13 @@ export const PageProvider = ({
return (
<PageContext.Provider value={contextValue}>
{isOpen ? (
<div className={isOpen ? 'hidden' : ''} aria-hidden={isOpen}>
<AnimatedBackground />
<SubsectionNav items={navItems} currentPath={currentPath} rightSlot={rightSlot} />
<div className="relative z-10">{children}</div>
</div>
{isOpen && (
<div
className="fixed inset-0 z-50 flex flex-col bg-black/90 backdrop-blur-sm transition-opacity duration-300"
role="dialog"
@ -150,7 +153,7 @@ export const PageProvider = ({
</span>
<button
onClick={closeModal}
className="w-11 h-11 sm:w-12 sm:h-12 rounded-full bg-white/10 hover:bg-white/20 text-white flex items-center justify-center transition-colors focus:outline-none focus:ring-2 focus:ring-white focus:ring-offset-2 focus:ring-offset-black/90"
className="w-9 h-9 sm:w-10 sm:h-10 rounded-full bg-white/10 hover:bg-white/20 text-white flex items-center justify-center transition-colors focus:outline-none focus:ring-2 focus:ring-white focus:ring-offset-2 focus:ring-offset-black/90"
aria-label="Close fullscreen view"
>
<svg
@ -178,12 +181,6 @@ export const PageProvider = ({
<CompactFooter />
</div>
) : (
<>
<AnimatedBackground />
<SubsectionNav items={navItems} currentPath={currentPath} rightSlot={rightSlot} />
<div className="relative z-10">{children}</div>
</>
)}
</PageContext.Provider>
);