Adds hero component
This commit is contained in:
@@ -1,23 +0,0 @@
|
|||||||
import { HStack, chakra } from '@chakra-ui/react';
|
|
||||||
import NavLink from './NavLink';
|
|
||||||
|
|
||||||
export default function NavigationBar() {
|
|
||||||
return (
|
|
||||||
<chakra.header
|
|
||||||
bg="none"
|
|
||||||
color="white"
|
|
||||||
border="none"
|
|
||||||
px={{ base: 4, md: 8 }}
|
|
||||||
py={4}
|
|
||||||
>
|
|
||||||
<HStack as="ul" gap={6} listStyleType="none">
|
|
||||||
<chakra.li>
|
|
||||||
<NavLink to="/">Home</NavLink>
|
|
||||||
</chakra.li>
|
|
||||||
<chakra.li>
|
|
||||||
<NavLink to="/over-mij">Over mij</NavLink>
|
|
||||||
</chakra.li>
|
|
||||||
</HStack>
|
|
||||||
</chakra.header>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
@@ -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 (
|
||||||
|
<Box
|
||||||
|
as="section"
|
||||||
|
aria-label="Uitgelicht werk"
|
||||||
|
position="relative"
|
||||||
|
h="100svh"
|
||||||
|
minH="560px"
|
||||||
|
overflow="hidden"
|
||||||
|
bg="gray.900"
|
||||||
|
backgroundImage={`url(${heroImage})`}
|
||||||
|
backgroundPosition="center"
|
||||||
|
backgroundSize="cover"
|
||||||
|
backgroundRepeat="no-repeat"
|
||||||
|
>
|
||||||
|
{/* Scrim */}
|
||||||
|
<Box
|
||||||
|
aria-hidden
|
||||||
|
position="absolute"
|
||||||
|
inset={0}
|
||||||
|
bgGradient="to-b"
|
||||||
|
gradientFrom="rgba(35, 33, 32, 0.45)"
|
||||||
|
gradientVia="rgba(35, 33, 32, 0.18)"
|
||||||
|
gradientTo="rgba(35, 33, 32, 0.45)"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Container
|
||||||
|
position="relative"
|
||||||
|
zIndex={1}
|
||||||
|
h="100%"
|
||||||
|
display="flex"
|
||||||
|
flexDirection="column"
|
||||||
|
alignItems="center"
|
||||||
|
justifyContent="center"
|
||||||
|
textAlign="center"
|
||||||
|
color="white"
|
||||||
|
>
|
||||||
|
<Text
|
||||||
|
mb={4}
|
||||||
|
fontSize="sm"
|
||||||
|
letterSpacing="0.2em"
|
||||||
|
textTransform="uppercase"
|
||||||
|
opacity={0.8}
|
||||||
|
>
|
||||||
|
Fotografie
|
||||||
|
</Text>
|
||||||
|
<Heading
|
||||||
|
as="h1"
|
||||||
|
mb={9}
|
||||||
|
fontSize={{ base: '5xl', md: '7xl' }}
|
||||||
|
lineHeight={1}
|
||||||
|
color="white"
|
||||||
|
>
|
||||||
|
Andrea Slop
|
||||||
|
</Heading>
|
||||||
|
<Button asChild variant="outline" color="white" borderColor="white">
|
||||||
|
<Link to="/over-mij">Lees meer</Link>
|
||||||
|
</Button>
|
||||||
|
</Container>
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -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 (
|
||||||
|
<chakra.header
|
||||||
|
position="fixed"
|
||||||
|
top={0}
|
||||||
|
insetX={0}
|
||||||
|
zIndex="docked"
|
||||||
|
bg={isSolid ? 'white' : 'transparent'}
|
||||||
|
color={isSolid ? 'fg' : 'white'}
|
||||||
|
boxShadow={isSolid ? 'sm' : 'none'}
|
||||||
|
border="none"
|
||||||
|
px={{ base: 4, md: 8 }}
|
||||||
|
py={4}
|
||||||
|
transition="background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease"
|
||||||
|
>
|
||||||
|
<Container>
|
||||||
|
<Flex
|
||||||
|
gap={6}
|
||||||
|
alignItems="center"
|
||||||
|
justifyContent="space-between"
|
||||||
|
>
|
||||||
|
<Box
|
||||||
|
flexBasis="auto"
|
||||||
|
flexGrow={1}
|
||||||
|
flexShrink={0}
|
||||||
|
aspectRatio="square"
|
||||||
|
maxW="50px"
|
||||||
|
>
|
||||||
|
<Image src={isSolid ? logoDark : logoLight} />
|
||||||
|
</Box>
|
||||||
|
<HStack
|
||||||
|
as="ul"
|
||||||
|
gap={6}
|
||||||
|
listStyleType="none"
|
||||||
|
flexBasis="100%"
|
||||||
|
flexGrow={0}
|
||||||
|
flexShrink={1}
|
||||||
|
justifyContent="center"
|
||||||
|
>
|
||||||
|
<chakra.li>
|
||||||
|
<NavLink to="/">Home</NavLink>
|
||||||
|
</chakra.li>
|
||||||
|
<chakra.li>
|
||||||
|
<NavLink to="/over-mij">Over mij</NavLink>
|
||||||
|
</chakra.li>
|
||||||
|
</HStack>
|
||||||
|
<chakra.div flexBasis="auto" flexGrow={1} flexShrink={0}>
|
||||||
|
<chakra.button
|
||||||
|
onClick={() => {
|
||||||
|
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)',
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<span />
|
||||||
|
<span />
|
||||||
|
<span />
|
||||||
|
</chakra.button>
|
||||||
|
</chakra.div>
|
||||||
|
</Flex>
|
||||||
|
</Container>
|
||||||
|
</chakra.header>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
import { createRootRoute } from "@tanstack/react-router";
|
import { createRootRoute } from '@tanstack/react-router';
|
||||||
import { TanStackRouterDevtools } from "@tanstack/react-router-devtools";
|
import { TanStackRouterDevtools } from '@tanstack/react-router-devtools';
|
||||||
import AppShell from "../../components/AppShell";
|
import AppShell from '../components/AppShell';
|
||||||
|
|
||||||
const RootLayout = () => (
|
const RootLayout = () => (
|
||||||
<>
|
<>
|
||||||
<AppShell />
|
<AppShell />
|
||||||
<TanStackRouterDevtools />
|
<TanStackRouterDevtools />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
export const Route = createRootRoute({ component: RootLayout });
|
export const Route = createRootRoute({ component: RootLayout });
|
||||||
|
|||||||
@@ -1,14 +1,10 @@
|
|||||||
import { Heading } from '@chakra-ui/react';
|
|
||||||
import { createFileRoute } from '@tanstack/react-router';
|
import { createFileRoute } from '@tanstack/react-router';
|
||||||
|
import Hero from '../components/Hero/Hero';
|
||||||
|
|
||||||
export const Route = createFileRoute('/')({
|
export const Route = createFileRoute('/')({
|
||||||
component: Index,
|
component: Index,
|
||||||
});
|
});
|
||||||
|
|
||||||
function Index() {
|
function Index() {
|
||||||
return (
|
return <Hero />;
|
||||||
<div className="p-2">
|
|
||||||
<Heading>Welcome Home!</Heading>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-7
@@ -1,5 +1,4 @@
|
|||||||
import { createSystem, defaultConfig, defineConfig } from '@chakra-ui/react';
|
import { createSystem, defaultConfig, defineConfig } from '@chakra-ui/react';
|
||||||
import heroImage from './assets/hero-1.jpg';
|
|
||||||
|
|
||||||
const config = defineConfig({
|
const config = defineConfig({
|
||||||
cssVarsRoot: ':where(:root, :host)',
|
cssVarsRoot: ':where(:root, :host)',
|
||||||
@@ -7,12 +6,7 @@ const config = defineConfig({
|
|||||||
preflight: true,
|
preflight: true,
|
||||||
globalCss: {
|
globalCss: {
|
||||||
body: {
|
body: {
|
||||||
backgroundImage: `url(${heroImage})`,
|
height: '250vh',
|
||||||
backgroundPosition: 'top center',
|
|
||||||
backgroundSize: 'cover',
|
|
||||||
backgroundRepeat: 'no-repeat',
|
|
||||||
height: '100vh',
|
|
||||||
width: '100vw',
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
theme: {
|
theme: {
|
||||||
|
|||||||
+1
-1
@@ -24,5 +24,5 @@
|
|||||||
"erasableSyntaxOnly": true,
|
"erasableSyntaxOnly": true,
|
||||||
"noFallthroughCasesInSwitch": true
|
"noFallthroughCasesInSwitch": true
|
||||||
},
|
},
|
||||||
"include": ["src", "components"]
|
"include": ["src", "src/components"]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user