изменила моб версию меню

This commit is contained in:
xomimishka committed 2025-07-11 11:37:12 +03:00
1 parent 9fc9755a74
commit 72c66667f9
2 files changed
+153 -33

No files matched your search

+99 -11
View File
@@ -90,29 +90,41 @@
} }
.bar { .bar {
display: none; display: flex;
flex-direction: column; flex-direction: column;
position: fixed; position: fixed;
top: 0; top: 0;
right: 0; right: -100%;
background-color: white; background-color: white;
width: 50%; width: 100%;
height: 200vh; height: 100vh;
z-index: 9; z-index: 9;
padding: 60px 0px; padding: 100px 30px 30px;
transition: transform 0.3s ease-in-out;
overflow-y: auto;
&.open { &.open {
display: flex; transform: translateX(-100%);
} }
.nav-link { .nav-link {
padding: 10px 5px; margin-left: 0;
padding: 15px 0;
width: 100%; width: 100%;
text-align: left; text-align: left;
} font-size: 16px*1.2;
font-weight: 600;
color: black;
transition: color 0.3s ease;
.nav-link::after { &::after {
background: none; display: none;
}
&:hover,
&:focus {
color: #072ac8;
}
} }
} }
@@ -121,20 +133,96 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
z-index: 10; z-index: 10;
cursor: pointer;
.line { .line {
width: 25px; width: 30px;
height: 3px; height: 3px;
background-color: #072ac8; background-color: #072ac8;
margin: 4px 0; margin: 4px 0;
transition: all 0.3s ease; transition: all 0.3s ease;
&:nth-child(1).open {
transform: rotate(45deg) translate(5px, 5px);
}
&:nth-child(2).open {
opacity: 0;
}
&:nth-child(3).open {
transform: rotate(-45deg) translate(10px, -10px);
}
} }
} }
}
}
.overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 8;
opacity: 0;
visibility: hidden;
transition: opacity 0.3s ease, visibility 0.3s ease;
&.open {
opacity: 1;
visibility: visible;
} }
} }
#navbar.transparent .bar .nav-link::after { #navbar.transparent .bar .nav-link::after {
background-color: $text-secondary; background-color: $text-secondary;
}
.mobile-contacts {
display: none;
@media (max-width: 1200px) {
display: flex;
flex-direction: column;
margin-top: auto;
text-align: left;
font-weight: 600;
color: black;
align-self: flex-start;
width: 100%;
a {
display: block;
margin: 4px 0;
}
.btn {
display: block;
width: 100%;
padding: 16px 24px;
margin: 20px auto 0;
border-radius: 8px;
border: none;
font-size: 20px;
font-weight: 600;
line-height: 24px;
color: white;
background: linear-gradient(93.25deg, #4942e4 0%, #11009e 50%, #4942e4 100%);
background-size: 200%;
background-position: 0%;
transition: background-position 0.5s ease, transform 0.3s ease, box-shadow 0.3s ease;
cursor: pointer;
text-align: center;
text-decoration: none;
&:hover {
background-position: 100%;
box-shadow: 0 8px 20px rgba(17, 0, 158, 0.25);
color: #ffffff;
}
}
}
} }
+54 -22
View File
@@ -1,7 +1,7 @@
import { useState, useEffect } from "react"; import { useState, useEffect } from "react";
import NavbarLink from "./NavbarLink"; import NavbarLink from "./NavbarLink";
import { useLocation } from "react-router-dom"; import { useLocation } from "react-router-dom";
import { HashLink } from "react-router-hash-link";
import logo from "@/shared/assets/images/sсb_blue.svg"; import logo from "@/shared/assets/images/sсb_blue.svg";
import "./Navbar.styles.scss"; import "./Navbar.styles.scss";
@@ -46,6 +46,28 @@ const mock: LinkType[] = [
}, },
]; ];
interface ContactsType {
email: JSX.Element;
phone: JSX.Element;
}
const mockContacts: ContactsType = {
email: (
<a style={{
fontSize: "19.2px",
color: "inherit",
fontWeight: "600",
}} href="mailto:skb@sfedu.ru">
skb@sfedu.ru
</a>
),
phone: (
<a style={{ color: "inherit", fontSize: "19.2px", }} href="tel:+79780095480">
+7 (978) 009-54-80
</a>
),
};
function Navbar({ links = mock }: NavbarProps) { function Navbar({ links = mock }: NavbarProps) {
const [isOpen, setIsOpen] = useState(false); const [isOpen, setIsOpen] = useState(false);
const [navbarHidden, setNavbarHidden] = useState(false); const [navbarHidden, setNavbarHidden] = useState(false);
@@ -107,29 +129,39 @@ function Navbar({ links = mock }: NavbarProps) {
return ( return (
<div <>
id="navbar" <div
className={`${isTransparent ? "transparent" : ""} ${navbarHidden ? "hidden" : "" id="navbar"
}`} className={`${isTransparent ? "transparent" : ""} ${navbarHidden ? "hidden" : ""
> }`}
>
<NavbarLink className="logo-container" link={{ to: "/" }}> <NavbarLink className="logo-container" link={{ to: "/" }}>
<img src={logo} className="logo" alt="SCB logo" /> <img src={logo} className="logo" alt="SCB logo" />
</NavbarLink> </NavbarLink>
<div className="burger" onClick={toggleMenu}> <div className="burger" onClick={toggleMenu}>
<span className={`line ${isOpen ? "open" : ""}`}></span> <span className={`line ${isOpen ? "open" : ""}`}></span>
<span className={`line ${isOpen ? "open" : ""}`}></span> <span className={`line ${isOpen ? "open" : ""}`}></span>
<span className={`line ${isOpen ? "open" : ""}`}></span> <span className={`line ${isOpen ? "open" : ""}`}></span>
</div>
<div className={`bar ${isOpen ? "open" : ""}`}>
{links.map((link, index) => (
<NavbarLink
link={{ ...link, onClick: handleLinkClick }}
key={index}
/>
))}
<div className="mobile-contacts">
{mockContacts.phone}
{mockContacts.email}
<HashLink smooth to="/contact#contact-form-anchor" className={"btn"}>
Связаться с нами
</HashLink>
</div>
</div>
</div> </div>
<div className={`bar ${isOpen ? "open" : ""}`}> <div className={`overlay ${isOpen ? "open" : ""}`} onClick={toggleMenu}></div>
{links.map((link, index) => ( </>
<NavbarLink
link={{ ...link, onClick: handleLinkClick }}
key={index}
/>
))}
</div>
</div>
); );
} }