diff --git a/src/pages/Main/Main.jsx b/src/pages/Main/Main.jsx index 40d021b..36ccfc8 100755 --- a/src/pages/Main/Main.jsx +++ b/src/pages/Main/Main.jsx @@ -1,31 +1,22 @@ -import { useEffect } from 'react'; +import { useContext } from 'react'; import { News, Projects, Labs, Partners, Gallery, ContactUs } from './components'; -import useElementOnScreen from '../../lib/useElementOnScreen'; +import { RootContext } from '../Root'; + +import './Main.styles.scss'; function Main() { - const [containerRef, isVisible] = useElementOnScreen({ - root: null, - rootMargin: '0px', - threshold: 0, - }); - - useEffect(() => { - const [ navbar ] = document.getElementsByClassName('navbar'); - if (isVisible) { - navbar.classList.add('absolute'); - } else { - navbar.classList.remove('absolute'); - } - }, [isVisible]); + const { containerRef } = useContext(RootContext); return ( <>
-

Думай иначе, будь креативным!

-

Студенческое конструкторское бюро
- "Компьютерное инновационное творчество"

- Связаться с нами +
+

Думай иначе, будь креативным!

+

Студенческое конструкторское бюро
+ "Компьютерное инновационное творчество"

+ Связаться с нами +
diff --git a/src/pages/Main/Main.styles.scss b/src/pages/Main/Main.styles.scss new file mode 100644 index 0000000..84a7d9b --- /dev/null +++ b/src/pages/Main/Main.styles.scss @@ -0,0 +1,36 @@ +@import "../../assets/styles/theme.scss"; + +#mainpageheader { + position: relative; + + height: 100vh; + padding: 0 10%; + + color: $text-secondary; + background-image: url(/assets/images/car.jpeg); + background-color: $bg-image; + background-blend-mode: multiply; + background-position: center; + background-size: cover; + + .container { + position: absolute; + top: 40%; + display: flex; + flex-direction: column; + + + h1 { + font-size: 60px; + font-weight: 600; + line-height: 63px; + margin: 0; + } + + h2 { + font-size: 24px; + font-weight: 400; + line-height: 36px; + } + } +} \ No newline at end of file diff --git a/src/pages/Root/Root.jsx b/src/pages/Root/Root.jsx index f3d0cc9..e07af02 100755 --- a/src/pages/Root/Root.jsx +++ b/src/pages/Root/Root.jsx @@ -1,25 +1,46 @@ import { Outlet, useLoaderData } from "react-router-dom"; +import { createContext, useEffect } from 'react'; import { getContacts } from "../../api"; +import useElementOnScreen from '../../lib/useElementOnScreen'; import Navbar from '../../components/Navbar'; import Footer from "../../components/Footer"; import './Root.styles.scss'; +export const RootContext = createContext(); + async function loader() { const contacts = await getContacts(); return { contacts }; } function Root() { - const { contacts } = useLoaderData(); + + const [containerRef, isVisible] = useElementOnScreen({ + root: null, + rootMargin: '0px', + threshold: 0, + }); + + useEffect(() => { + const [navbar] = document.getElementsByClassName('navbar'); + if (isVisible) { + navbar.classList.add('absolute'); + } else { + navbar.classList.remove('absolute'); + } + }, [isVisible]); + return ( - <> +