add new pages

This commit is contained in:
aurinex
2025-07-09 17:29:31 +05:00
parent 824a79a117
commit 43d4cbcb89
17 changed files with 1703 additions and 229 deletions

View File

@ -21,7 +21,7 @@ const Header = () => {
const [scrolled, setScrolled] = useState(false);
const menuItems = [
{ title: "О нас", anchor: "#about" },
{ title: "О нас", anchor: "#about-us" },
{ title: "Калькулятор", anchor: "#calculator" },
{ title: "Отзывы", anchor: "#reviews" },
{ title: "Контакты", anchor: "#contacts" },
@ -29,7 +29,7 @@ const Header = () => {
{ title: "Команда", anchor: "#team" },
{ title: "Доставленные авто", anchor: "#delivered" },
{ title: "Этапы работы", anchor: "#stages" },
{ title: " ", anchor: "#main"},
{ title: " ", anchor: "#main" },
];
// Отслеживание скролла
@ -48,21 +48,23 @@ const Header = () => {
};
}, []);
const toggleDrawer = (open: boolean) => (event: React.KeyboardEvent | React.MouseEvent) => {
if (
event.type === "keydown" &&
((event as React.KeyboardEvent).key === "Tab" || (event as React.KeyboardEvent).key === "Shift")
) {
return;
}
setDrawerOpen(open);
};
// Используем глобальную функцию из utils
const handleScrollToAnchor = (anchor: string) => {
scrollToAnchor(anchor, setDrawerOpen, isMobile);
const toggleDrawer =
(open: boolean) => (event: React.KeyboardEvent | React.MouseEvent) => {
if (
event.type === "keydown" &&
((event as React.KeyboardEvent).key === "Tab" ||
(event as React.KeyboardEvent).key === "Shift")
) {
return;
}
setDrawerOpen(open);
};
// Используем глобальную функцию из utils
const handleScrollToAnchor = (anchor: string) => {
scrollToAnchor(anchor, setDrawerOpen, isMobile);
};
return (
<>
<Box
@ -98,8 +100,7 @@ const Header = () => {
"&:hover": { scale: 1.1 },
transition: "all 0.4s ease",
}}
>
</Box>
></Box>
{isMobile ? (
<Box
@ -154,19 +155,15 @@ const Header = () => {
<Box sx={{ height: isMobile ? "15vw" : "10vw" }} />
{/* Мобильное меню */}
<Drawer
anchor="right"
open={drawerOpen}
onClose={toggleDrawer(false)}
>
<Drawer anchor="right" open={drawerOpen} onClose={toggleDrawer(false)}>
<Box
sx={{ width: "58vw", bgcolor: "#2D2D2D", height: "100%" }}
role="presentation"
>
<List>
{menuItems.map((item, index) => (
<ListItem
key={index}
<ListItem
key={index}
onClick={() => handleScrollToAnchor(item.anchor)}
sx={{ cursor: "pointer" }}
>
@ -188,7 +185,11 @@ const Header = () => {
</Box>
</Drawer>
<Feedback open={feedbackOpen} onClose={() => setFeedbackOpen(false)} handleScrollToAnchor={handleScrollToAnchor} />
<Feedback
open={feedbackOpen}
onClose={() => setFeedbackOpen(false)}
handleScrollToAnchor={handleScrollToAnchor}
/>
</>
);
};