diff --git a/web/components/NavigationBar/NavigationBar.tsx b/web/components/NavigationBar/NavigationBar.tsx deleted file mode 100644 index f1d244d..0000000 --- a/web/components/NavigationBar/NavigationBar.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { HStack, chakra } from '@chakra-ui/react'; -import NavLink from './NavLink'; - -export default function NavigationBar() { - return ( - - - - Home - - - Over mij - - - - ); -} diff --git a/web/src/assets/logo-dark.png b/web/src/assets/logo-dark.png new file mode 100644 index 0000000..afeb48f Binary files /dev/null and b/web/src/assets/logo-dark.png differ diff --git a/web/src/assets/logo-light.png b/web/src/assets/logo-light.png new file mode 100644 index 0000000..35186f4 Binary files /dev/null and b/web/src/assets/logo-light.png differ diff --git a/web/components/AppShell.tsx b/web/src/components/AppShell.tsx similarity index 100% rename from web/components/AppShell.tsx rename to web/src/components/AppShell.tsx diff --git a/web/components/Footer.tsx b/web/src/components/Footer.tsx similarity index 100% rename from web/components/Footer.tsx rename to web/src/components/Footer.tsx diff --git a/web/src/components/Hero/Hero.tsx b/web/src/components/Hero/Hero.tsx new file mode 100644 index 0000000..5152c50 --- /dev/null +++ b/web/src/components/Hero/Hero.tsx @@ -0,0 +1,70 @@ +import { Box, Button, Container, Heading, Text } from '@chakra-ui/react'; +import { Link } from '@tanstack/react-router'; + +// Images +import heroImage from '../../assets/hero-1.jpg'; + +// TODO: slider met meerdere slides, thumbnails, progress-balk en socials +// zoals in design/andreaslop-static/index.html +export default function Hero() { + return ( + + {/* Scrim */} + + + + + Fotografie + + + Andrea Slop + + + + + ); +} diff --git a/web/components/NavigationBar/NavLink.tsx b/web/src/components/NavigationBar/NavLink.tsx similarity index 100% rename from web/components/NavigationBar/NavLink.tsx rename to web/src/components/NavigationBar/NavLink.tsx diff --git a/web/src/components/NavigationBar/NavigationBar.tsx b/web/src/components/NavigationBar/NavigationBar.tsx new file mode 100644 index 0000000..2b2d1f2 --- /dev/null +++ b/web/src/components/NavigationBar/NavigationBar.tsx @@ -0,0 +1,119 @@ +import { Flex, HStack, chakra, Image, Box, Container } from '@chakra-ui/react'; +import NavLink from './NavLink'; +import useScrolledPast from '@/hooks/useScrolledPast'; +import { useState } from 'react'; +import { useRouterState } from '@tanstack/react-router'; + +// Images +import logoLight from '../../assets/logo-light.png'; +import logoDark from '../../assets/logo-dark.png'; + +export default function NavigationBar() { + let [open, setOpen] = useState(false); + + const pastHero = useScrolledPast(() => 150); + const isHome = useRouterState({ + select: (state) => state.location.pathname === '/', + }); + const isSolid = pastHero || !isHome; + + return ( + + + + + + + + + Home + + + Over mij + + + + { + setOpen(!open); + console.log('Clicked menu button, open:', open); + }} + auria-label="{open ? 'Sluit menu' : 'Open menu'}" + aria-expanded={open} + data-open={open || undefined} + position="relative" + w="32px" + h="32px" + cursor="pointer" + zIndex="modal" + css={{ + '& > span': { + position: 'absolute', + left: '4px', + width: '24px', + height: '2px', + bg: 'currentColor', + borderRadius: '1px', + transition: + 'transform 0.3s ease, opacity 0.2s ease, top 0.3s ease', + }, + '& > span:nth-of-type(1)': { top: '9px' }, + '& > span:nth-of-type(2)': { top: '15px' }, + '& > span:nth-of-type(3)': { top: '21px' }, + + // open kruisje + '&[data-open] > span:nth-of-type(1)': { + top: '15px', + transform: 'rotate(45deg)', + }, + '&[data-open] > span:nth-of-type(2)': { + opacity: 0, + top: '15px', + transform: 'rotate(45deg)', + }, + '&[data-open] > span:nth-of-type(3)': { + top: '15px', + transform: 'rotate(-45deg)', + }, + }} + > + + + + + + + + + ); +} diff --git a/web/src/hooks/useScrolledPast.tsx b/web/src/hooks/useScrolledPast.tsx new file mode 100644 index 0000000..744e268 --- /dev/null +++ b/web/src/hooks/useScrolledPast.tsx @@ -0,0 +1,14 @@ +import { useEffect, useState } from 'react'; + +export default function useScrolledPast(getThreshold: () => number) { + const [scrolled, setScrolled] = useState(false); + + useEffect(() => { + const onScroll = () => setScrolled(window.scrollY > getThreshold()); + onScroll(); + window.addEventListener('scroll', onScroll, { passive: true }); + return () => window.removeEventListener('scroll', onScroll); + }, [getThreshold]); + + return scrolled; +} diff --git a/web/src/routes/__root.tsx b/web/src/routes/__root.tsx index a976859..265773b 100644 --- a/web/src/routes/__root.tsx +++ b/web/src/routes/__root.tsx @@ -1,12 +1,12 @@ -import { createRootRoute } from "@tanstack/react-router"; -import { TanStackRouterDevtools } from "@tanstack/react-router-devtools"; -import AppShell from "../../components/AppShell"; +import { createRootRoute } from '@tanstack/react-router'; +import { TanStackRouterDevtools } from '@tanstack/react-router-devtools'; +import AppShell from '../components/AppShell'; const RootLayout = () => ( - <> - - - + <> + + + ); export const Route = createRootRoute({ component: RootLayout }); diff --git a/web/src/routes/index.tsx b/web/src/routes/index.tsx index 123efd9..3e41625 100644 --- a/web/src/routes/index.tsx +++ b/web/src/routes/index.tsx @@ -1,14 +1,10 @@ -import { Heading } from '@chakra-ui/react'; import { createFileRoute } from '@tanstack/react-router'; +import Hero from '../components/Hero/Hero'; export const Route = createFileRoute('/')({ component: Index, }); function Index() { - return ( -
- Welcome Home! -
- ); + return ; } diff --git a/web/src/theme.ts b/web/src/theme.ts index bfbb42c..cad7422 100644 --- a/web/src/theme.ts +++ b/web/src/theme.ts @@ -1,5 +1,4 @@ import { createSystem, defaultConfig, defineConfig } from '@chakra-ui/react'; -import heroImage from './assets/hero-1.jpg'; const config = defineConfig({ cssVarsRoot: ':where(:root, :host)', @@ -7,12 +6,7 @@ const config = defineConfig({ preflight: true, globalCss: { body: { - backgroundImage: `url(${heroImage})`, - backgroundPosition: 'top center', - backgroundSize: 'cover', - backgroundRepeat: 'no-repeat', - height: '100vh', - width: '100vw', + height: '250vh', }, }, theme: { diff --git a/web/tsconfig.json b/web/tsconfig.json index 2eeba38..40db6a4 100644 --- a/web/tsconfig.json +++ b/web/tsconfig.json @@ -24,5 +24,5 @@ "erasableSyntaxOnly": true, "noFallthroughCasesInSwitch": true }, - "include": ["src", "components"] + "include": ["src", "src/components"] }