Skip to content

Commit 7e16b75

Browse files
Add hero component
1 parent d78d6d9 commit 7e16b75

File tree

15 files changed

+160
-28
lines changed

15 files changed

+160
-28
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
2121
- decoration components
2222
- nav component styling and intersection api
2323
- CardsColumns.js and Card.js
24+
- Header.js component
2425

2526
### Fixed
2627

components/Hero.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import Image from 'next/image';
2+
import Nav from './Nav';
3+
import Container from './Container';
4+
import styles from '../styles/Hero.module.scss';
5+
6+
export default function Hero({
7+
title,
8+
imgBg,
9+
imgAlt,
10+
dynamicTitle,
11+
content,
12+
customClass,
13+
titleClass,
14+
}) {
15+
return (
16+
<div className={`${styles.header} ${customClass && styles[customClass]}`}>
17+
<Nav />
18+
<Image
19+
src={imgBg}
20+
alt={imgAlt}
21+
className={styles.imageBg}
22+
layout="fill"
23+
objectFit="cover"
24+
objectPosition="center"
25+
priority
26+
/>
27+
<Container className={styles.header__content}>
28+
<div className={styles.header__content__upper}>
29+
<h1 className={`${titleClass && styles[titleClass]}`}>
30+
{title}
31+
{dynamicTitle && <span> {dynamicTitle}</span>}
32+
</h1>
33+
</div>
34+
<div className={styles.header__content__bottom}>
35+
<p>{content}</p>
36+
</div>
37+
</Container>
38+
</div>
39+
);
40+
}

components/Layout.js

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,61 @@
1-
import Nav from './Nav';
1+
import { useRouter } from 'next/router';
2+
import Hero from './Hero';
23
import Meta from './Meta';
34
import Footer from './Footer';
45
import styles from '../styles/Layout.module.scss';
56

67
export default function Layout({ children }) {
8+
const router = useRouter();
9+
const heroOptions = {
10+
'/': {
11+
imgBg: '/images/home-bg.png',
12+
imgAlt: 'Homepage',
13+
title: 'Web Dev Path is about',
14+
dynamicTitle: 'Community',
15+
content:
16+
'We help junior tech professionals, such as developers and designers, to grow.',
17+
},
18+
'/about': {
19+
imgBg: '/images/about-us-bg.png',
20+
imgAlt: 'About Us',
21+
title: 'About Us',
22+
titleClass: 'accent-title',
23+
content:
24+
'While the demand for web developers only increases, becoming one can be quite a journey!',
25+
},
26+
'/contact': {
27+
imgBg: '/images/about-us-bg.png',
28+
imgAlt: 'Contact Us',
29+
title: 'Contact Us',
30+
titleClass: 'accent-title',
31+
content:
32+
'We help junior tech professionals, such as developers and designers, to grow.',
33+
},
34+
'/blog': {
35+
imgBg: '/images/about-us-bg.png',
36+
imgAlt: 'Blog',
37+
title: 'Our Blog',
38+
titleClass: 'accent-title',
39+
content:
40+
'We help junior tech professionals, such as developers and designers, to grow.',
41+
},
42+
'/404': {
43+
imgBg: '/images/about-us-bg.png',
44+
imgAlt: 'Not Found',
45+
title: 'Not Found',
46+
titleClass: 'accent-title',
47+
content:
48+
'We help junior tech professionals, such as developers and designers, to grow.',
49+
},
50+
};
751
return (
852
<>
953
<Meta />
10-
<Nav />
11-
<main className={styles.main}>{children}</main>
12-
<Footer />
54+
<main className={styles.main}>
55+
<Hero {...heroOptions[router.pathname]} />
56+
{children}
57+
<Footer />
58+
</main>
1359
</>
1460
);
1561
}

components/Nav.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export default function Nav() {
1515
useEffect(() => {
1616
const observer = new IntersectionObserver(
1717
([entry]) => {
18+
if (!containerRef.current) return;
1819
if (!entry.isIntersecting) {
1920
containerRef.current.classList.add(styles.sticky);
2021
} else {
File renamed without changes.
File renamed without changes.

pages/index.js

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,12 @@ import { white, primary } from '../styles/TwoColumn.module.scss';
77

88
export default function Home() {
99
return (
10-
<div className={styles.inner}>
11-
<div className={styles.description}>
12-
<h1 className={styles.title}>&lt; Web Dev wannabe? /&gt;</h1>
13-
<p>
14-
Hold our hand and enjoy the road to learn how to start a new project,
15-
the magic behind Github while working in a team environment, and much
16-
more...
17-
</p>
18-
</div>
19-
10+
<>
2011
<TwoColumn
2112
title="Let's grow together."
2213
image="/images/join-us.jpg"
2314
content="The Web Dev Path is a team of professional developers project that aims to provide a comprehensive path for people who seek to begin their web development journey."
24-
link="/about-us"
15+
link="/about"
2516
customBtnClass="inverted-grey"
2617
/>
2718

@@ -48,7 +39,7 @@ export default function Home() {
4839
'Would you like to volunteer? For roles other than mentor/mentee, please get in touch.',
4940
'Are you an experienced web dev who wants to become a mentor? Welcome!',
5041
]}
51-
links={['/about-us', '/contact-us', '/about-us']}
42+
links={['/about', '/contact', '/about']}
5243
linkText={['Learn more', 'Contact us', 'Learn more']}
5344
/>
5445

@@ -59,10 +50,10 @@ export default function Home() {
5950
content="Web Dev Path can help your nonprofit with web projects of various sizes. Connect with us to find out how."
6051
color={white}
6152
bgColor={primary}
62-
link="/about-us"
53+
link="/about"
6354
customInnerClass="non-profit"
6455
customBtnClass="inverted-white"
6556
/>
66-
</div>
57+
</>
6758
);
6859
}

public/images/about-us-bg.png

11.8 MB
Loading

public/images/home-bg.png

8.58 MB
Loading

styles/Hero.module.scss

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
@use './variables' as *;
2+
@use './mixins' as *;
3+
4+
.header {
5+
display: flex;
6+
flex-direction: column;
7+
align-items: center;
8+
z-index: 10;
9+
position: relative;
10+
@include desktop {
11+
height: 100vh;
12+
}
13+
14+
.accent-title {
15+
color: $primary-accent-color;
16+
}
17+
18+
&__content {
19+
z-index: 10;
20+
color: $white;
21+
padding-top: 9%;
22+
23+
&__upper {
24+
max-width: 41rem;
25+
span {
26+
color: $primary-accent-color;
27+
font-style: italic;
28+
font-weight: bold;
29+
line-height: 3.5rem;
30+
@include desktop {
31+
font-size: 4.5rem;
32+
line-height: 5rem;
33+
}
34+
}
35+
}
36+
37+
&__bottom {
38+
max-width: 41rem;
39+
padding-bottom: 5rem;
40+
41+
@include desktop {
42+
padding-bottom: 0;
43+
}
44+
}
45+
}
46+
}

0 commit comments

Comments
 (0)