Skip to content

Commit 9c2af6e

Browse files
Merge pull request #150 from Web-Dev-Path/fix/legacy-image
Replace next/legacy/image with next/image for next.js 13 upgrade
2 parents 8e7272f + 4923a65 commit 9c2af6e

File tree

12 files changed

+42
-53
lines changed

12 files changed

+42
-53
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
8484
### Added
8585

8686
### Fixed
87-
- adjusted contact form message on mobile
87+
88+
- replaced next/legacy/image with next/image
89+
- removed unused function in api/register.js
90+
- adjusted contact form message on mobile
91+

components/containers/Card.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Image from 'next/legacy/image';
1+
import Image from 'next/image';
22
import Link from 'next/link';
33
import styles from '@/styles/Card.module.scss';
44

@@ -21,13 +21,7 @@ export default function Card({
2121
>
2222
{image && (
2323
<div className={styles.card__image}>
24-
<Image
25-
src={image}
26-
alt={altTag}
27-
className={styles.img}
28-
layout='fill'
29-
objectFit='cover'
30-
/>
24+
<Image src={image} alt={altTag} className={styles.img} fill />
3125
</div>
3226
)}
3327

components/containers/Member.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Image from 'next/legacy/image';
1+
import Image from 'next/image';
22
import styles from '@/styles/Member.module.scss';
33

44
export default function Member({
@@ -9,13 +9,12 @@ export default function Member({
99
about,
1010
linkedIn,
1111
portfolio,
12-
customClass,
1312
}) {
1413
return (
1514
<div className={styles.card}>
1615
{image && (
1716
<div className={styles.card__image}>
18-
<Image src={image} alt={name} className={styles.img} layout='fill' />
17+
<Image src={image} alt={name} fill />
1918
</div>
2019
)}
2120

@@ -28,8 +27,8 @@ export default function Member({
2827
<Image
2928
src='/images/svg/linkedin-portfolio.svg'
3029
alt='LinkedIn'
31-
height='25px'
32-
width='25px'
30+
height={25}
31+
width={25}
3332
/>
3433
<a
3534
href={`https://linkedin.com/in/${linkedIn}`}
@@ -45,8 +44,8 @@ export default function Member({
4544
<Image
4645
src='/images/svg/globe.svg'
4746
alt='Web Site'
48-
height='25px'
49-
width='25px'
47+
height={25}
48+
width={25}
5049
/>
5150
<a
5251
href={`https://${portfolio}`}

components/containers/TwoColumn.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Image from 'next/legacy/image';
1+
import Image from 'next/image';
22
import ButtonLink from '@/components/buttons/ButtonLink';
33
import Container from '@/components/containers/Container';
44
import styles from '@/styles/TwoColumn.module.scss';
@@ -57,12 +57,7 @@ export default function TwoColumn({
5757
{secondTextColumn && secondTextColumn}
5858
{!secondTextColumn && image && (
5959
<div className={styles.inner__image}>
60-
<Image
61-
src={image}
62-
alt={altTag}
63-
className={styles.img}
64-
layout='fill'
65-
/>
60+
<Image src={image} alt={altTag} className={styles.img} fill />
6661
</div>
6762
)}
6863
</Container>

components/layout/Footer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import Image from 'next/image';
12
import footerStyles from '@/styles/Footer.module.scss';
23
import { linksNav, linksSocial } from '@/utils/links';
34
import NewsletterSubscribe from '@/components/mailchimp/NewsletterSubscribe';
4-
import Image from 'next/legacy/image';
55
import Container from '@/components/containers/Container';
66

77
export default function Footer() {

components/layout/Hero.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useState } from 'react';
2-
import Image from 'next/legacy/image';
2+
import Image from 'next/image';
33
import Nav from '@/components/layout/Nav';
44
import Container from '@/components/containers/Container';
55
import styles from '@/styles/Hero.module.scss';
@@ -29,9 +29,7 @@ export default function Hero({
2929
src={imgBg}
3030
alt={imgAlt}
3131
className={styles.imageBg}
32-
layout='fill'
33-
objectFit='cover'
34-
objectPosition='center'
32+
fill
3533
priority
3634
/>
3735
<Container customClass={styles.header__content}>

components/layout/Nav.js

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useState, useEffect, useRef } from 'react';
2-
import Image from 'next/legacy/image';
32
import { useRouter } from 'next/router';
3+
import Link from 'next/link';
44
import Container from '@/components/containers/Container';
55
import styles from '@/styles/Nav.module.scss';
66
import { linksNav } from '@/utils/links';
@@ -55,17 +55,14 @@ export default function Nav() {
5555
<Container>
5656
<div ref={containerRef}>
5757
<nav className={styles.nav}>
58-
<div className={styles.nav__logo}>
59-
<a href='/' passhref='true'>
60-
<Image
61-
src='/images/svg/logo.svg'
62-
height={115}
63-
width={180}
64-
alt='Logo'
65-
title='Go to the Homepage'
66-
/>
67-
</a>
68-
</div>
58+
<Link href='/'>
59+
<img
60+
className={styles.nav__logo}
61+
src='/images/svg/logo.svg'
62+
alt='Logo'
63+
title='Go to the Homepage'
64+
/>
65+
</Link>
6966
<ul
7067
className={`${styles.nav__links} ${active ? styles.active : ''}`}
7168
>

components/mailchimp/NewsletterForm.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { createRef, useState } from 'react';
2-
import Image from 'next/legacy/image';
2+
import Image from 'next/image';
33
import { decode } from 'html-entities';
44
import ReCAPTCHA from 'react-google-recaptcha';
55
import Container from '@/components/containers/Container';
@@ -124,7 +124,6 @@ const NewsletterForm = ({ status, message, onValidated }) => {
124124
height={18}
125125
width={18}
126126
alt='Right Chevron SVG'
127-
className={newsletterStyles.newsletter__right_chevron_image}
128127
/>
129128
</span>
130129
</h2>

pages/about.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import Wrapper from '@/components/containers/Wrapper';
1212
import Container from '@/components/containers/Container';
1313
import Row from '@/components/containers/Row';
1414
import Member from '@/components/containers/Member';
15-
import { whoWeAre } from '../utils/about';
15+
import { whoWeAre } from '@/utils/about';
1616

1717
export default function AboutUs() {
1818
return (
@@ -34,6 +34,7 @@ export default function AboutUs() {
3434
}
3535
rowOrder='row'
3636
image='/images/svg/square-brackets.svg'
37+
altTag='Square Brackets'
3738
color={primary}
3839
bgColor={primaryAccent}
3940
customInnerClass='our-background'
@@ -74,6 +75,7 @@ export default function AboutUs() {
7475
}
7576
rowOrder='row-reverse'
7677
image='/images/svg/open-angle-bracket.svg'
78+
altTag='Open angle bracket'
7779
color={primary}
7880
bgColor={white}
7981
customInnerClass='our-process'
@@ -95,6 +97,7 @@ export default function AboutUs() {
9597
</div>
9698
}
9799
image='/images/svg/close-angle-bracket.svg'
100+
altTag='close-angle-bracket'
98101
color={primary}
99102
bgColor={white}
100103
customInnerClass='our-process'
@@ -138,6 +141,7 @@ export default function AboutUs() {
138141
}
139142
rowOrder='row-reverse'
140143
image='/images/svg/semi-colon.svg'
144+
altTag='Semi-colon'
141145
color={primary}
142146
bgColor={white}
143147
customInnerClass='our-purpose'
@@ -148,6 +152,7 @@ export default function AboutUs() {
148152
title='Wanna learn more?'
149153
content={''}
150154
image='/images/svg/close-curly-bracket.svg'
155+
altTag='Close curly bracket'
151156
color={primary}
152157
bgColor={lightBgColor}
153158
customInnerClass='wanna-learn-more'
@@ -216,6 +221,7 @@ export default function AboutUs() {
216221
}
217222
rowOrder='row-reverse'
218223
image='/images/svg/slash.svg'
224+
altTag='Slash'
219225
color={primary}
220226
bgColor={white}
221227
customInnerClass='get-started'
@@ -252,6 +258,7 @@ export default function AboutUs() {
252258
title='Still got questions?'
253259
content='Feel free to contact us.'
254260
image='/images/svg/hashtag.svg'
261+
altTag='Hashtag'
255262
color={primary}
256263
bgColor={white}
257264
customInnerClass='questions'

pages/api/register.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
const sleep = () =>
2-
new Promise(resolve => {
3-
setTimeout(() => {
4-
resolve();
5-
}, 350);
6-
});
7-
81
export default async function handler(req, res) {
92
const SECRET_KEY = process.env.RECAPTCHA_SECRET_KEY;
103

@@ -35,9 +28,6 @@ export default async function handler(req, res) {
3528
const captchaValidation = await response.json();
3629

3730
if (captchaValidation.success) {
38-
// Replace this with the API that will save the data received
39-
// to your backend
40-
await sleep();
4131
// Return 200 if everything is successful
4232
return res.status(200).send('OK');
4333
}

0 commit comments

Comments
 (0)