Skip to content

Commit 385192f

Browse files
committed
Add styling to navbar
1 parent c2c91a0 commit 385192f

File tree

4 files changed

+270
-158
lines changed

4 files changed

+270
-158
lines changed

components/Footer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Link from 'next/link';
22
import footerStyles from '../styles/Footer.module.scss';
3-
import { footerNavLinks } from '../utils/links';
3+
import { linksNav } from '../utils/links';
44
import NewsletterSubscribe from './mailchimp/NewsletterSubscribe';
55
import Image from 'next/image';
66

@@ -11,7 +11,7 @@ export default function Footer() {
1111
<section className={footerStyles.footer__section}>
1212
<nav className={footerStyles.footer__nav} aria-label="Main">
1313
<ul className={footerStyles.footer__navList}>
14-
{footerNavLinks.map(link => (
14+
{linksNav.map(link => (
1515
<li className={footerStyles.footer__navItem} key={link.text}>
1616
<Link href={link.href}>{link.text}</Link>
1717
</li>

components/Nav.js

Lines changed: 51 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,17 @@
11
import Link from 'next/link';
2-
import { useEffect, useState } from 'react';
2+
import { useState } from 'react';
33
import styles from '../styles/Nav.module.scss';
4-
import { headerNavLinks } from '../utils/links';
54
import Image from 'next/image';
5+
import ButtonLink from './ButtonLink';
6+
import buttonStyles from '../styles/ButtonLink.module.scss';
67

78
export default function Nav() {
8-
const [active, setActive] = useState(false);
9-
10-
//This function fixes the Navlinks position if the hamburger menu is left open while resizing the window
11-
useEffect(() => {
12-
function setTrueSize() {
13-
if (window.innerWidth >= 768) setActive(false);
14-
}
15-
window.addEventListener('resize', setTrueSize);
16-
17-
return () => window.removeEventListener('resize', setTrueSize);
18-
});
19-
20-
const toggleActive = () => {
21-
setActive(active => !active);
22-
};
9+
const [active, setActive] = useState(true);
2310

2411
return (
2512
<header className={styles.header}>
26-
<div className={`${styles.navContainer} ${styles.row}`}>
27-
<div className={styles.align}>
13+
<nav className={styles.nav}>
14+
<div className={styles.nav__logo}>
2815
<Link href="/" passHref>
2916
<a>
3017
<Image
@@ -35,28 +22,52 @@ export default function Nav() {
3522
/>
3623
</a>
3724
</Link>
38-
<button
39-
className={styles.navToggle}
40-
aria-label="open navigation"
41-
onClick={toggleActive}
42-
>
43-
<span className={styles.hamburger} />
44-
</button>
4525
</div>
46-
<nav className={`${active ? styles.navVisible : styles.nav}`}>
47-
<ul className={styles.navList}>
48-
{headerNavLinks.map(link => (
49-
<li className={styles.navItem} key={link.href}>
50-
<Link href={link.href}>
51-
<a className={styles.navLink} title={link.text}>
52-
{link.text}
53-
</a>
54-
</Link>
55-
</li>
56-
))}
57-
</ul>
58-
</nav>
59-
</div>
26+
<ul className={`${styles.nav__links} ${active ? styles.active : ''}`}>
27+
<li className={styles.nav__item}>
28+
<Link href="/about-us">
29+
<a className={styles.nav__link} title="About">
30+
About
31+
</a>
32+
</Link>
33+
</li>
34+
<li className={styles.nav__item}>
35+
<Link href="/blog">
36+
<a className={styles.nav__link} title="Blog">
37+
Blog
38+
</a>
39+
</Link>
40+
</li>
41+
<li className={styles.nav__item}>
42+
<Link href="/contact-us">
43+
<a className={styles.nav__link} title="Contact">
44+
Contact
45+
</a>
46+
</Link>
47+
</li>
48+
<li className={styles.nav__item}>
49+
<ButtonLink
50+
styles={{
51+
color: 'black',
52+
backgroundColor: 'white',
53+
minWidth: '9rem',
54+
}}
55+
className={buttonStyles.btn}
56+
link="https://webdevpath.slack.com/join/shared_invite/zt-xqqgwwo5-a09BSVWC9ZrHmS6RaMBzVw#/shared-invite/email"
57+
>
58+
Join us
59+
</ButtonLink>
60+
</li>
61+
</ul>
62+
<div
63+
className={`${styles.nav__hamburger} ${active ? styles.active : ''}`}
64+
onClick={() => setActive(active => !active)}
65+
>
66+
<span className={styles.nav__hamburger__bar}></span>
67+
<span className={styles.nav__hamburger__bar}></span>
68+
<span className={styles.nav__hamburger__bar}></span>
69+
</div>
70+
</nav>
6071
</header>
6172
);
6273
}

0 commit comments

Comments
 (0)