Skip to content

Commit

Permalink
Update next 14 (#688)
Browse files Browse the repository at this point in the history
* update next, react, react-dom

* update target property in next.config.js

* update node version

* lint files

* lint and remove craCompat

* switch to link legacy behavior

* lint files

* switch to image legacy behavior

* fix photo display

* update @testing-library/react

* install @netlify/plugin-nextjs

* remove output in next.config.js

* upgrade to node 20

* update @netlify/plugin-nextjs

* remove redundant babel config

* stop throwing errors on invalid events; warn instead

* update lock files

* chore: apply missed changes after rebase

* chore: switch to link legacy behavior

* style: lint files

* chore: update @netlify/plugin-nextjs

* fix: remove legacyBehavior tag from town hall page

* build: change from build to .next

* test: add .babelrc to make tests pass

* refactor: remove comments

* refactor: remove unnecessary redirects file

---------

Co-authored-by: Arsh Malik <[email protected]>
  • Loading branch information
snigdha-kansal and ArshMalik02 authored Feb 8, 2025
1 parent ba061f6 commit 67ad98e
Show file tree
Hide file tree
Showing 55 changed files with 5,742 additions and 22,429 deletions.
2 changes: 1 addition & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"presets": ["next/babel"]
}
}
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

strategy:
matrix:
node-version: [16.x]
node-version: [20.x]

env:
EVENTS_SPREADSHEET_ID: ${{ secrets.EVENTS_SPREADSHEET_ID }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/node-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

strategy:
matrix:
node-version: [16.x]
node-version: [20.x]

env:
EVENTS_SPREADSHEET_ID: ${{ secrets.EVENTS_SPREADSHEET_ID }}
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
/node_modules
/.pnp
.pnp.js
yarn.lock

# testing
/coverage
Expand Down Expand Up @@ -39,3 +40,6 @@ offoutput.json
townhall.json
past-townhall.json
gmData.json

# Local Netlify folder
.netlify
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
lts/gallium
lts/iron
2 changes: 0 additions & 2 deletions _redirects

This file was deleted.

6 changes: 3 additions & 3 deletions components/ActiveLink.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ const ActiveLink = ({ children, activeClassName, ...props }) => {
: childClassName;

return (
//clones child with className if className exists
<Link {...props}>
//clones child with className if className exists
(<Link {...props} legacyBehavior>
{React.cloneElement(child, {
className: className || null,
})}
</Link>
</Link>)
);
};

Expand Down
2 changes: 1 addition & 1 deletion components/Carousel.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Image from 'next/image';
import Image from 'next/legacy/image';
import React from 'react';

// width of each img in px
Expand Down
2 changes: 1 addition & 1 deletion components/Committees/CommitteeEventCard.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Image from 'next/image';
import Image from 'next/legacy/image';
import React from 'react';

function CommitteeEventCard(props) {
Expand Down
2 changes: 1 addition & 1 deletion components/Committees/CommitteeSectionIntro.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from '@fortawesome/free-brands-svg-icons';
import { faLink } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import Image from 'next/image';
import Image from 'next/legacy/image';
import React from 'react';

function CommitteeIconLink({ committee, link }) {
Expand Down
4 changes: 2 additions & 2 deletions components/DevProjectCards.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ function Project({
function projects(props) {
return (
// TODO: more flexible mobile views
<>
(<>
{props.projects.map((project) => (
<Project
{...project}
Expand All @@ -121,7 +121,7 @@ function projects(props) {
key={project.name}
/>
))}
</>
</>)
);
}

Expand Down
20 changes: 10 additions & 10 deletions components/Events/SelectedEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function SelectedEvent({ event }) {
}, [event]);

return (
<div className={styles['card-container']}>
(<div className={styles['card-container']}>
<h2 className={styles['card-header']}>event information</h2>
{/* eslint-disable-next-line @next/next/no-img-element */}
<img
Expand All @@ -42,21 +42,21 @@ function SelectedEvent({ event }) {
<ul className="list-unstyled">
{links.map(({ text, href, ext }) => (
<li key={href}>
<Link href={href}>
<a
className={styles['event-link']}
target={ext ? '_blank' : ''}
rel={ext ? 'noopener noreferrer' : ''}
>
{text}
</a>
<Link
href={href}
className={styles['event-link']}
target={ext ? '_blank' : ''}
rel={ext ? 'noopener noreferrer' : ''}>

{text}

</Link>
</li>
))}
</ul>
)}
</div>
</div>
</div>)
);
}

Expand Down
52 changes: 26 additions & 26 deletions components/Footer.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Link from 'next/link';
import React from 'react';
import SocialMedia from './SocialMedia';
import committees from '../data/committees';
import styles from '../styles/components/Footer.module.scss';
import SocialMedia from './SocialMedia';

const footerACMLinks = [
{ title: 'About', path: '/about' },
Expand All @@ -27,21 +27,21 @@ const footerInitiativeLinks = [

function FooterLinkElement({ title, path, ext }) {
return (
<Link href={path}>
<a
className={styles['link-footer']}
target={ext ? '_blank' : ''}
rel={ext ? 'noopener noreferrer' : ''}
>
{title}
</a>
</Link>
(<Link
href={path}
className={styles['link-footer']}
target={ext ? '_blank' : ''}
rel={ext ? 'noopener noreferrer' : ''}>

{title}

</Link>)
);
}

function Footer() {
return (
<footer className={styles.footer}>
(<footer className={styles.footer}>
<nav
className={styles['footer-inner']}
aria-labelledby="footer-navigation"
Expand All @@ -54,25 +54,25 @@ function Footer() {
<h3 className={styles['footer-header']}>Find us on social media</h3>
<SocialMedia type="light" />
<div className="mt-1">
<Link href="http://eepurl.com/hdEvNP">
<a
className="button tight"
target="_blank"
rel="noreferrer noopener"
>
<Link
href="http://eepurl.com/hdEvNP"
className="button tight"
target="_blank"
rel="noreferrer noopener">

Join our Mailing List
</a>

</Link>
</div>
<div className="mt-1">
<Link href="https://linktr.ee/acmucla">
<a
className="button tight"
target="_blank"
rel="noreferrer noopener"
>
<Link
href="https://linktr.ee/acmucla"
className="button tight"
target="_blank"
rel="noreferrer noopener">

Linktree
</a>

</Link>
</div>
<p className={styles['footer-header']}>Reach us at</p>
Expand Down Expand Up @@ -151,7 +151,7 @@ function Footer() {
</span>
</div>
</nav>
</footer>
</footer>)
);
}

Expand Down
50 changes: 25 additions & 25 deletions components/Impact/BlogCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,30 @@ export default function BlogCard({
// TODO: not sure how, but we need to semantically
// insert a description of the image for screenreaders;
// not natively supported by background-image
<Link href={href}>
<a
target="_blank"
className={styles['blog-card']}
style={backgroundStyle}
>
<div className={styles['blog-card-content']}>
<h4 className={styles['blog-title']}>{title}</h4>
<p className={styles['blog-info']}>
{/* eslint-disable-next-line @next/next/no-img-element */}
<img
className={styles['blog-author-img']}
src={authorImg}
alt={authorAlt}
/>
<div>
{author}
<br />
{/* TODO: moment for date? */}
{date}{length}
</div>
</p>
</div>
</a>
</Link>
(<Link
href={href}
target="_blank"
className={styles['blog-card']}
style={backgroundStyle}>

<div className={styles['blog-card-content']}>
<h4 className={styles['blog-title']}>{title}</h4>
<p className={styles['blog-info']}>
{/* eslint-disable-next-line @next/next/no-img-element */}
<img
className={styles['blog-author-img']}
src={authorImg}
alt={authorAlt}
/>
<div>
{author}
<br />
{/* TODO: moment for date? */}
{date}{length}
</div>
</p>
</div>

</Link>)
);
}
2 changes: 1 addition & 1 deletion components/Impact/Carousel.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { useState, useEffect } from 'react';

import BlogCard from './BlogCard';
import { blogs } from '../../data/impact';
import styles from '../../styles/pages/impact.module.scss';

import BlogCard from './BlogCard';

function Carousel() {
const [activeItem, changeActiveItem] = useState(0); // keeps track of blog index (0, 1, or 2) that is currently active
Expand Down
2 changes: 1 addition & 1 deletion components/Impact/WorkshopCard.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Image from 'next/image';
import Image from 'next/legacy/image';
import React from 'react';

import styles from '../../styles/pages/impact.module.scss';
Expand Down
2 changes: 1 addition & 1 deletion components/Internship/CommitteeInternshipInfo.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Image from 'next/image';
import Image from 'next/legacy/image';
import React, { useState } from 'react';

import styles from '../../styles/components/Internship/CommitteeInternshipInfo.module.scss';
Expand Down
28 changes: 14 additions & 14 deletions components/Internship/NextSteps.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,6 @@ import React from 'react';
function NextSteps(props) {
const { image, name, info } = props;
return (
<>
<div
style={{
border: '1px solid grey',
margin: '5px',
borderRadius: '5px',
padding: '15px',
}}
>
{/* eslint-disable-next-line @next/next/no-img-element */}
<img src={image} alt={name} height="30px" />
<p>{info}</p>
</div>
</>
// <button className={styles['committee-card']} onClick={() => setFlipped(!isFlipped)} role='tab'>
// <div className={`${styles['next-steps-card-inner']} ${styles[isFlipped ? null : 'is-flipped']}`}>
// <div className={styles['next-steps-card-face']}>
Expand All @@ -32,6 +18,20 @@ function NextSteps(props) {
// </div>
// </div>
// </button>
(<>
<div
style={{
border: '1px solid grey',
margin: '5px',
borderRadius: '5px',
padding: '15px',
}}
>
{/* eslint-disable-next-line @next/next/no-img-element */}
<img src={image} alt={name} height="30px" />
<p>{info}</p>
</div>
</>)
);
}

Expand Down
14 changes: 7 additions & 7 deletions components/JEDI/AllyshipSpaceCard.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Image from 'next/image';
import Image from 'next/legacy/image';
import Link from 'next/link';
import React from 'react';

Expand All @@ -22,7 +22,7 @@ function AllyshipSpaceCard({
priority,
}) {
return (
<div className={`${styles['allyship-row']} ${styles['mb-2']}`}>
(<div className={`${styles['allyship-row']} ${styles['mb-2']}`}>
<div className={styles['allyship-image']}>
<Image src={img} alt={alt} priority={priority} />
</div>
Expand All @@ -31,15 +31,15 @@ function AllyshipSpaceCard({
{/* wrapped in a fragment to allow for spacing */}
{rsvp && (
<>
<Link href={rsvp}>
<a className={styles['jedi-link']}>RSVP</a>
<Link href={rsvp} className={styles['jedi-link']}>
RSVP
</Link>{' '}
</>
)}
{slides && (
<>
<Link href={slides}>
<a className={styles['jedi-link']}>Slides</a>
<Link href={slides} className={styles['jedi-link']}>
Slides
</Link>{' '}
</>
)}
Expand All @@ -53,7 +53,7 @@ function AllyshipSpaceCard({
</p>
<p className={styles['my-tight']}>{description}</p>
</div>
</div>
</div>)
);
}

Expand Down
Loading

0 comments on commit 67ad98e

Please sign in to comment.