diff --git a/package-lock.json b/package-lock.json index 409cc9e..ed5da31 100755 --- a/package-lock.json +++ b/package-lock.json @@ -37,6 +37,7 @@ "react-dom": "^18.3.1", "react-fast-marquee": "^1.6.5", "react-hook-form": "^7.54.2", + "react-input-mask": "^2.0.4", "react-modal": "^3.16.3", "react-router": "^7.1.1", "react-router-dom": "^6.28.1", @@ -3942,6 +3943,15 @@ "resolved": "https://registry.npmjs.org/inline-style-parser/-/inline-style-parser-0.2.4.tgz", "integrity": "sha512-0aO8FkhNZlj/ZIbNi7Lxxr12obT7cL1moPfE4tg1LkX7LlLfC6DeX4l2ZEud1ukP9jNQyNnfzQVqwbwmAATY4Q==" }, + "node_modules/invariant": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", + "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==", + "license": "MIT", + "dependencies": { + "loose-envify": "^1.0.0" + } + }, "node_modules/is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", @@ -7489,6 +7499,20 @@ "react": "^16.8.0 || ^17 || ^18 || ^19" } }, + "node_modules/react-input-mask": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/react-input-mask/-/react-input-mask-2.0.4.tgz", + "integrity": "sha512-1hwzMr/aO9tXfiroiVCx5EtKohKwLk/NT8QlJXHQ4N+yJJFyUuMT+zfTpLBwX/lK3PkuMlievIffncpMZ3HGRQ==", + "license": "MIT", + "dependencies": { + "invariant": "^2.2.4", + "warning": "^4.0.2" + }, + "peerDependencies": { + "react": ">=0.14.0", + "react-dom": ">=0.14.0" + } + }, "node_modules/react-is": { "version": "19.0.0", "resolved": "https://registry.npmjs.org/react-is/-/react-is-19.0.0.tgz", diff --git a/package.json b/package.json index 0ce3910..8681d8f 100755 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "react-dom": "^18.3.1", "react-fast-marquee": "^1.6.5", "react-hook-form": "^7.54.2", + "react-input-mask": "^2.0.4", "react-modal": "^3.16.3", "react-router": "^7.1.1", "react-router-dom": "^6.28.1", diff --git a/src/app/Layout/Root.styles.scss b/src/app/Layout/Root.styles.scss index bde2d5f..abc3cc6 100644 --- a/src/app/Layout/Root.styles.scss +++ b/src/app/Layout/Root.styles.scss @@ -1,50 +1,61 @@ -// Общий стиль #root { - position: relative; // Убедитесь, что #root имеет relative + position: relative; background-repeat: no-repeat; background-position: center bottom; - background-image: url("../../shared/assets/images/backround/bg_footer_02.svg"); background-size: 100% auto; - z-index: 0; // Задний план - opacity: 0; // Сделаем #root видимым сразу - min-height: 100vh; // Устанавливаем минимальную высоту для #root + z-index: 0; + opacity: 0; + min-height: 100vh; + background-image: url("../../shared/assets/images/backround/bg_footer_02.svg"); - // Псевдоэлемент для фона в верхней части страницы &::before { content: ""; position: absolute; top: 160px; - left: 0; // Слева - width: 100%; // На всю ширину - height: 364px; // Ограничиваем максимальную высоту - background-image: url("../../shared/assets/images/backround/bg_news_block.svg"); // Картинка + left: 0; + width: 100%; + height: 364px; + background-image: url("../../shared/assets/images/backround/bg_news_block.svg"); background-repeat: no-repeat; background-position: left center; background-size: contain; - z-index: -1; // Картинка на заднем плане, за остальными элементами + z-index: -1; @media (max-width: 768px) { - display: none; // Прячем картинку на мобильных устройствах + display: none; + } + } + + &.main-page { + background-image: url("../../shared/assets/images/backround/bg_footer.svg"); + + &::before { + background-image: none; + } + } + + &.inner-page { + background-image: url("../../shared/assets/images/backround/bg_footer_02.svg"); + + &::before { + background-image: url("../../shared/assets/images/backround/bg_news_block.svg"); } } } -// Для главной страницы -#root:has(> #react-page #mainpageheader) { - background-image: url("../../shared/assets/images/backround/bg_footer.svg"); - &::before { - background-image: none; - } -} -#react-page:has(> #mainpageheader) { - margin-top: 0; -} .page-loaded #root { opacity: 1; visibility: visible; } +#layout-wrapper { + display: flex; + flex-direction: column; + min-height: 100vh; +} + #react-page { + flex: 1; margin-top: calc($navbar-height + 5 * $navbar-padding-tb); .header, @@ -60,30 +71,27 @@ .content { background: $bg-primary; - //padding: 0 1em; border-radius: 8px; display: flex; flex-direction: column; - //box-shadow: 0px 6px 15px rgba(0, 0, 0, 0.1); } } .block .heading a, #navbar .nav-link { position: relative; -} -.block .heading a::after, -#navbar .nav-link::after { - position: absolute; - content: ""; - left: 50%; - transform: translateX(-50%); - bottom: 0; - display: block; - width: 0; - height: 1px; - transition: 0.3s; + &::after { + position: absolute; + content: ""; + left: 50%; + transform: translateX(-50%); + bottom: 0; + display: block; + width: 0; + height: 1px; + transition: 0.3s; + } } .block .heading a::after { @@ -98,21 +106,21 @@ .scroll-to-top { position: fixed; - right: 2vw; // Используем vw для адаптивности - bottom: 7.5vh; // Используем vh для адаптивности + right: 2vw; + bottom: 7.5vh; background-color: white; border-radius: 50%; width: 61px; height: 61px; z-index: 10; - border: none; cursor: pointer; opacity: 0; transform: scale(0); transition: opacity 0.3s ease, transform 0.3s ease; - animation: scaleIn 0.5s forwards; /* Анимация появления */ + animation: scaleIn 0.5s forwards; box-shadow: 5px 6px 15px rgba(0, 0, 0, 0.05); + &.visible { opacity: 1; transform: scale(1); @@ -122,15 +130,18 @@ &.hidden { opacity: 0; transform: scale(0); - animation: scaleOut 0.5s forwards; /* Анимация исчезновения */ + animation: scaleOut 0.5s forwards; } img { height: auto; } + + @media (max-width: 768px) { + display: none; + } } -/* Анимация для появления кнопки */ @keyframes scaleIn { 0% { opacity: 0; @@ -142,7 +153,6 @@ } } -/* Анимация для исчезновения кнопки */ @keyframes scaleOut { 0% { opacity: 1; @@ -153,9 +163,3 @@ transform: scale(0); } } - -@media (max-width: 768px) { - .scroll-to-top { - display: none; // Скрыть кнопку на мобильных устройствах - } -} diff --git a/src/app/Layout/Root.tsx b/src/app/Layout/Root.tsx index b11b732..b3c7396 100644 --- a/src/app/Layout/Root.tsx +++ b/src/app/Layout/Root.tsx @@ -71,16 +71,30 @@ function Root() { // Определяем, находимся ли мы на главной странице const isHomePage = location.pathname === "/"; + useEffect(() => { + const rootElement = document.getElementById("root"); + + if (!rootElement) return; + + if (location.pathname === "/") { + rootElement.classList.add("main-page"); + rootElement.classList.remove("inner-page"); + } else { + rootElement.classList.remove("main-page"); + rootElement.classList.add("inner-page"); + } + }, [location.pathname]); + + return ( - -
- +
+ +
+ +
+
-
{hasScrolled && (
diff --git a/src/shared/assets/images/numbers/Illustration.png b/src/shared/assets/images/numbers/Illustration.png new file mode 100644 index 0000000..50e17aa Binary files /dev/null and b/src/shared/assets/images/numbers/Illustration.png differ diff --git a/src/shared/assets/images/numbers/index.js b/src/shared/assets/images/numbers/index.js new file mode 100644 index 0000000..985ed98 --- /dev/null +++ b/src/shared/assets/images/numbers/index.js @@ -0,0 +1,4 @@ +export { default as ten } from './ten.svg'; +export { default as twenty } from './twenty.svg'; +export { default as thirty } from './thirty.svg'; +export { default as Illustration } from './Illustration.png'; \ No newline at end of file diff --git a/src/shared/assets/images/numbers/ten.svg b/src/shared/assets/images/numbers/ten.svg new file mode 100644 index 0000000..c82c113 --- /dev/null +++ b/src/shared/assets/images/numbers/ten.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/src/shared/assets/images/numbers/thirty.svg b/src/shared/assets/images/numbers/thirty.svg new file mode 100644 index 0000000..54ac54f --- /dev/null +++ b/src/shared/assets/images/numbers/thirty.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/src/shared/assets/images/numbers/twenty.svg b/src/shared/assets/images/numbers/twenty.svg new file mode 100644 index 0000000..569dd8b --- /dev/null +++ b/src/shared/assets/images/numbers/twenty.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/src/widgets/Card/Card.module.scss b/src/widgets/Card/Card.module.scss index 11d69f2..43402b3 100644 --- a/src/widgets/Card/Card.module.scss +++ b/src/widgets/Card/Card.module.scss @@ -98,6 +98,7 @@ height: 100%; object-fit: cover; transition: filter 0.3s ease; + pointer-events: none; } .title { diff --git a/src/widgets/ContactForm/ContactForm.styles.scss b/src/widgets/ContactForm/ContactForm.styles.scss index c5d8e39..b6c8556 100644 --- a/src/widgets/ContactForm/ContactForm.styles.scss +++ b/src/widgets/ContactForm/ContactForm.styles.scss @@ -3,27 +3,23 @@ $icon-size: 24px; $color-file-button: rgb(7, 42, 200); .contact-form { - padding: 20px 22px; + padding: 1.3rem 32px; border-radius: 16px; height: 100%; - width: 100%; background-color: $bg-form; - margin-top: 20px; + align-items: flex-start; + h2 { margin-top: 0; - min-width: 400px; font-size: 28px; font-weight: 500; line-height: 44px; @media (max-width: 768px) { font-size: 20px; - min-width: 0; } } - .smart-captcha { - min-width: 0; - } + .inputs { display: flex; flex-direction: column; @@ -41,7 +37,6 @@ $color-file-button: rgb(7, 42, 200); padding: 12px 16px; border: none; border-radius: 8px; - font-size: 16px; font-weight: 400; } @@ -50,6 +45,7 @@ $color-file-button: rgb(7, 42, 200); height: 300px; line-height: 30px; resize: none; + @media (max-width: 768px) { height: 200px; } @@ -77,16 +73,21 @@ $color-file-button: rgb(7, 42, 200); .upload-file-btn { display: flex; + align-items: center; + gap: 8px; cursor: pointer; + background: none; + border: none; // Убрана рамка + padding: 0; .icon { - filter: invert(15%) sepia(100%) saturate(2861%) hue-rotate(229deg) - brightness(93%) contrast(120%); + filter: invert(15%) sepia(100%) saturate(2861%) hue-rotate(229deg) brightness(93%) contrast(120%); } span { display: inline-block; font-size: 18px; + @media (max-width: 768px) { font-size: 16px; } @@ -118,7 +119,7 @@ $color-file-button: rgb(7, 42, 200); } } - .file-input input:focus + .upload-file-btn { + .file-input input:focus+.upload-file-btn { outline: -webkit-focus-ring-color auto 1px; } @@ -126,11 +127,31 @@ $color-file-button: rgb(7, 42, 200); .submit { width: 100%; cursor: pointer; - padding: 12px; font-size: 18px; line-height: normal; + margin-top: 0; + + &:disabled { + background-color: #aaaaaa; + color: dimgrey; + cursor: not-allowed; + } } } + + .agree-checkbox { + display: flex; + align-items: center; + gap: 5px; // Расстояние между чекбоксом и текстом + font-size: 14px; + } } } + +.checkbox-container { + margin-top: 15px; + display: flex; + align-items: center; + gap: 8px; +} \ No newline at end of file diff --git a/src/widgets/ContactForm/ContactForm.tsx b/src/widgets/ContactForm/ContactForm.tsx index ca5f084..01f1fd4 100644 --- a/src/widgets/ContactForm/ContactForm.tsx +++ b/src/widgets/ContactForm/ContactForm.tsx @@ -17,13 +17,16 @@ import { const formSchema = z.object({ name: z.string().min(1, "Обязательное поле"), email: z.string().email("Некорректный email. Пример 123@sfedu.ru"), + phone: z.string() + .min(1, "Обязательное поле") + .regex(/^\+7\s?\(?\d{3}\)?\s?\d{3}[-.\s]?\d{2}[-.\s]?\d{2}$/, "Некорректный номер телефона"), message: z.string().min(1, "Обязательное поле"), file: z - .any() // Используем `any`, чтобы избежать ошибки типа + .any() .optional() .nullable() .refine( - (file) => !file || file.length === 0 || file instanceof File, // Проверяем, что это File, если значение есть + (file) => !file || file.length === 0 || file instanceof File, "Файл должен быть экземпляром File" ) .refine( @@ -37,6 +40,7 @@ const formSchema = z.object({ ) .transform((value) => value ?? undefined), captcha: z.string().min(1, "Требуется проверка капчи"), + agree: z.boolean().refine(val => val, "Необходимо согласие на обработку данных"), }); type FormData = z.infer; @@ -55,9 +59,11 @@ function ContactForm() { defaultValues: { name: "", email: "", + phone: "", message: "", file: undefined, captcha: "", + agree: false, }, }); @@ -65,7 +71,31 @@ function ContactForm() { const file = watch("file"); const fileAttached = !!file && file instanceof File; - console.log(file); + const agree = watch("agree"); + + const handlePhoneChange = (e: React.ChangeEvent) => { + let value = e.target.value.replace(/\D/g, ''); + + if (value.length === 0 || value === '7') { + setValue("phone", ""); + return; + } + + if (value.length === 1) { + value = `+7 ${value}`; + } else if (value.length <= 4) { + value = `+7 (${value.slice(1)}`; + } else if (value.length <= 7) { + value = `+7 (${value.slice(1, 4)}) ${value.slice(4)}`; + } else if (value.length <= 9) { + value = `+7 (${value.slice(1, 4)}) ${value.slice(4, 7)}-${value.slice(7)}`; + } else { + value = `+7 (${value.slice(1, 4)}) ${value.slice(4, 7)}-${value.slice(7, 9)}-${value.slice(9, 11)}`; + } + + setValue("phone", value, { shouldValidate: true }); + }; + const handleFileChange = async (e: React.ChangeEvent) => { const selectedFile = e.target.files?.[0]; setValue("file", selectedFile || undefined, { shouldValidate: true }); @@ -87,12 +117,18 @@ function ContactForm() { setValue("captcha", ""); }, [setValue]); + const handleAgreeChange = (e: React.ChangeEvent) => { + setValue("agree", e.target.checked, { shouldValidate: true }); + }; + const onSubmit = async (data: FormData) => { const formData = new FormData(); formData.append("name", data.name); formData.append("email", data.email); + formData.append("phone", data.phone); formData.append("message", data.message); formData.append("captcha", data.captcha); + formData.append("agree", data.agree.toString()); if (data.file instanceof File) { formData.append("file", data.file); @@ -133,6 +169,16 @@ function ContactForm() { register={register("email")} error={errors.email?.message} /> + - +
+ + + {errors.agree && {errors.agree.message}} +
{watch("captcha") ? ( ) : (
@@ -175,4 +233,4 @@ function ContactForm() { ); } -export default ContactForm; +export default ContactForm; \ No newline at end of file diff --git a/src/widgets/ContactUs/ContactUs.styles.scss b/src/widgets/ContactUs/ContactUs.styles.scss index f57e003..b4cedb5 100644 --- a/src/widgets/ContactUs/ContactUs.styles.scss +++ b/src/widgets/ContactUs/ContactUs.styles.scss @@ -8,6 +8,7 @@ .half { flex: 1 1 50%; width: 100%; + font-weight: 600; } .contact-form { diff --git a/src/widgets/ContactUs/ContactUs.tsx b/src/widgets/ContactUs/ContactUs.tsx index 35c4d96..f19596e 100644 --- a/src/widgets/ContactUs/ContactUs.tsx +++ b/src/widgets/ContactUs/ContactUs.tsx @@ -7,8 +7,8 @@ function ContactUs() {

- Нужна помощь? -
Команда способных IT-специалистов готова вам помочь! + Есть вопросы? +
Команда способных
IT-специалистов готова
вам помочь!

diff --git a/src/widgets/Navbar/Navbar.styles.scss b/src/widgets/Navbar/Navbar.styles.scss index a7af027..6b86f24 100644 --- a/src/widgets/Navbar/Navbar.styles.scss +++ b/src/widgets/Navbar/Navbar.styles.scss @@ -11,130 +11,121 @@ justify-content: space-between; align-items: center; - transition: transform 0.3s ease-out, height 0.3s ease-out, - background-color 0.8s ease-out; + transition: transform 0.3s ease-out, height 0.3s ease-out, background-color 0.8s ease-out; &.hidden { - transform: translateY(-110%); // Убираем navbar вверх + transform: translateY(-110%); // Убираем navbar вверх } &:not(.hidden) { - transform: translateY(0); // Показываем navbar + transform: translateY(0); // Показываем navbar } &.transparent { - background-color: transparent !important; - transition: none; + background-color: transparent !important; + transition: none; - .bar .nav-link { - color: $text-secondary; + .bar .nav-link { + color: $text-secondary; + + @media (max-width: 1200px) { + color: black; + } + + } @media (max-width: 1200px) { - color: black; + .burger .line { + background-color: #ffffff; + &.open { + background-color: #072ac8; // Синий цвет, когда меню открыто + } + } } - } - @media (max-width: 1200px) { - .burger .line { - background-color: #ffffff; - - &.open { - background-color: #072ac8; // Синий цвет, когда меню открыто - } + .logo { + filter: brightness(0) invert(1); } - } - - .logo { - filter: brightness(0) invert(1); - } } .nav-link:has(> .logo) { - display: flex; - height: 100%; - align-items: center; + display: flex; + height: 100%; + align-items: center; - .logo { - width: $navbar-logo-height; - height: auto; - } + .logo { + width: $navbar-logo-height; + height: auto; + } } .bar { - display: flex; - align-items: center; - flex-wrap: wrap; - justify-content: flex-end; + display: flex; + align-items: center; - .nav-link { - font-size: 16px; - font-weight: 500; - line-height: 20px; - letter-spacing: 0em; - padding: 0.25em; - margin-left: 40px; - color: black; - text-decoration: none; - text-wrap: nowrap; - } + .nav-link { + font-size: 16px; + font-weight: 500; + line-height: 20px; + letter-spacing: 0em; + padding: .25em; + margin-left: 40px; + color: black; + text-decoration: none; + text-wrap: nowrap; + } - .nav-link::after { - background: $text-secondary; - } + .nav-link::after { + background: $text-secondary; + } } @media (max-width: 1200px) { - // height: $navbar-height; - // padding: $navbar-padding-tb 5%; + height: $navbar-height; + padding: $navbar-padding-tb 5%; - // .nav-link:has(> .logo) .logo { - // width: $navbar-logo-mini-height; - // } - - .bar { - display: none; - flex-direction: column; - position: fixed; - top: 0; - right: 0; - background-color: white; - width: 50%; - height: 200vh; - z-index: 9; - padding: 60px 0px; - - &.open { - display: flex; + .nav-link:has(> .logo) .logo { + width: $navbar-logo-mini-height; } - .nav-link { - padding: 10px 5px; - width: 100%; - text-align: left; - } - } + .bar { + display: none; + flex-direction: column; + position: fixed; + top: 0; + right: 0; + background-color: white; + width: 50%; + height: 200vh; + z-index: 9; + padding: 60px 0px; - .burger { - position: relative; - display: flex; - flex-direction: column; - z-index: 10; + &.open { + display: flex; + } - .line { - width: 25px; - height: 3px; - background-color: #072ac8; - margin: 4px 0; - transition: all 0.3s ease; + .nav-link { + padding: 10px 5px; + width: 100%; + text-align: left; + } } - } + + .burger { + position: relative; + display: flex; + flex-direction: column; + z-index: 10; + + .line { + width: 25px; + height: 3px; + background-color: #072ac8; + margin: 4px 0; + transition: all 0.3s ease; + } + } + } - @media (max-width: 768px) { - height: $navbar-height; - padding: $navbar-padding-tb 5%; - .nav-link:has(> .logo) .logo { - width: $navbar-logo-mini-height; - } - } } diff --git a/src/widgets/Navbar/Navbar.tsx b/src/widgets/Navbar/Navbar.tsx index f04a948..2243c21 100644 --- a/src/widgets/Navbar/Navbar.tsx +++ b/src/widgets/Navbar/Navbar.tsx @@ -1,5 +1,6 @@ import { useState, useEffect } from "react"; import NavbarLink from "./NavbarLink"; +import { useLocation } from "react-router-dom"; import logo from "@/shared/assets/images/sсb_blue.svg"; import "./Navbar.styles.scss"; @@ -50,6 +51,9 @@ function Navbar({ links = mock }: NavbarProps) { const [navbarHidden, setNavbarHidden] = useState(false); // true = спрятан, false = виден const [lastScrollTop, setLastScrollTop] = useState(0); const THRESHOLD = 400; // navbar не скрывается в первые 400px + const [isTransparent, setIsTransparent] = useState(true); + const [scrolledOnce, setScrolledOnce] = useState(false); + const location = useLocation(); // отслеживаем путь const toggleMenu = () => { setIsOpen(!isOpen); @@ -59,6 +63,17 @@ function Navbar({ links = mock }: NavbarProps) { setIsOpen(false); // Закрываем меню при клике на ссылку }; + useEffect(() => { + if (location.pathname === "/") { + setIsTransparent(true); + setScrolledOnce(false); + window.scrollTo(0, 0); + } else { + setIsTransparent(false); + } + }, [location]); + + // Для навбара useEffect(() => { const navbar = document.getElementById("navbar"); @@ -73,25 +88,43 @@ function Navbar({ links = mock }: NavbarProps) { const handleScroll = () => { const currentScrollTop = window.pageYOffset; - if (currentScrollTop <= THRESHOLD) { - setNavbarHidden(false); - } else { - if (currentScrollTop > lastScrollTop) { - setNavbarHidden(true); - } else { + if (!isOpen) { + if (currentScrollTop <= THRESHOLD) { setNavbarHidden(false); + } else { + if (currentScrollTop > lastScrollTop) { + setNavbarHidden(true); + } else { + setNavbarHidden(false); + } } } + // Прозрачность исчезает при первом скролле на главной + if ( + location.pathname === "/" && + !scrolledOnce && + currentScrollTop > 50 + ) { + setIsTransparent(false); + setScrolledOnce(true); + } + setLastScrollTop(currentScrollTop); }; window.addEventListener("scroll", handleScroll); return () => window.removeEventListener("scroll", handleScroll); - }, [lastScrollTop]); + }, [lastScrollTop, scrolledOnce, location.pathname, isOpen]); + return ( -