File size: 2,817 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
import React, { useState, useEffect } from 'react';
import { CSSTransition, TransitionGroup } from 'react-transition-group';
import styled from 'styled-components';
import { navDelay, loaderDelay } from '@utils';
import { usePrefersReducedMotion } from '@hooks';
const StyledHeroSection = styled.section`
${({ theme }) => theme.mixins.flexCenter};
flex-direction: column;
align-items: flex-start;
min-height: 100vh;
height: 100vh;
padding: 0;
@media (max-height: 700px) and (min-width: 700px), (max-width: 360px) {
height: auto;
padding-top: var(--nav-height);
}
h1 {
margin: 0 0 30px 4px;
color: var(--green);
font-family: var(--font-mono);
font-size: clamp(var(--fz-sm), 5vw, var(--fz-md));
font-weight: 400;
@media (max-width: 480px) {
margin: 0 0 20px 2px;
}
}
h3 {
margin-top: 5px;
color: var(--slate);
line-height: 0.9;
}
p {
margin: 20px 0 0;
max-width: 540px;
}
.email-link {
${({ theme }) => theme.mixins.bigButton};
margin-top: 50px;
}
`;
const Hero = () => {
const [isMounted, setIsMounted] = useState(false);
const prefersReducedMotion = usePrefersReducedMotion();
useEffect(() => {
if (prefersReducedMotion) {
return;
}
const timeout = setTimeout(() => setIsMounted(true), navDelay);
return () => clearTimeout(timeout);
}, []);
const one = <h1>Hi, my name is</h1>;
const two = <h2 className="big-heading">Brittany Chiang.</h2>;
const three = <h3 className="big-heading">I build things for the web.</h3>;
const four = (
<>
<p>
I’m a software engineer specializing in building (and occasionally designing) exceptional
digital experiences. Currently, I’m focused on building accessible, human-centered products
at{' '}
<a href="https://upstatement.com/" target="_blank" rel="noreferrer">
Upstatement
</a>
.
</p>
</>
);
const five = (
<a
className="email-link"
href="https://www.newline.co/courses/build-a-spotify-connected-app"
target="_blank"
rel="noreferrer">
Check out my course!
</a>
);
const items = [one, two, three, four, five];
return (
<StyledHeroSection>
{prefersReducedMotion ? (
<>
{items.map((item, i) => (
<div key={i}>{item}</div>
))}
</>
) : (
<TransitionGroup component={null}>
{isMounted &&
items.map((item, i) => (
<CSSTransition key={i} classNames="fadeup" timeout={loaderDelay}>
<div style={{ transitionDelay: `${i + 1}00ms` }}>{item}</div>
</CSSTransition>
))}
</TransitionGroup>
)}
</StyledHeroSection>
);
};
export default Hero;
|