Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

converted Speakers class to function #240

Merged
merged 3 commits into from
Apr 2, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 32 additions & 36 deletions src/app/components/speakers/speakers.js
Original file line number Diff line number Diff line change
@@ -1,47 +1,43 @@

import React from 'react';
import { speakersData } from "assets/data/speakers-info.js";
import './speakers.scss'

const Speaker = (name, title, photo, index) => {
return (
<div className="speaker-img-wrapper">
<img
src = {require('assets/images/speaker-photos/'+photo+'.jpeg')}
alt = {name + "'s profile picture"}
/>
<div className="text">
<h4>{name}</h4>
<p>{title}</p>
</div>
</div>
);
}
export default function Speakers() {

alicetran1221 marked this conversation as resolved.
Show resolved Hide resolved
const renderSpeakers = (speakers) => {
return (
<div className="speaker-photos">
{speakers.map((speaker, index) =>
Speaker(speaker.name, speaker.title, speaker.photo, index)
)}
</div>
)
}
function Speaker(name, title, photo, index) {
return (
alicetran1221 marked this conversation as resolved.
Show resolved Hide resolved
<div className="speaker-img-wrapper">
<img
src = {require('assets/images/speaker-photos/'+photo+'.jpeg')}
alt = {name + "'s profile picture"}
/>
<div className="text">
<h4>{name}</h4>
<p>{title}</p>
</div>
</div>
)
}

export default class Speakers extends React.Component {
render() {
function renderSpeakers(speakers) {
return (
alicetran1221 marked this conversation as resolved.
Show resolved Hide resolved
<div id="speakers">
<p className="subheader">Opening Speakers</p>
{renderSpeakers(speakersData.opening)}
<p className="subheader">Closing Speakers</p>
{renderSpeakers(speakersData.closing)}
<p className="subheader">Panelists</p>
{renderSpeakers(speakersData.panelists)}
<div className="speaker-photos">
{speakers.map((speaker, index) =>
Speaker(speaker.name, speaker.title, speaker.photo, index)
)}
</div>
)
}
}

// <p className="subheader">Keynote</p>
// {renderSpeakers(speakersData.keynotes)}
return (
<div id="speakers">
<p className="subheader">Opening Speakers</p>
{renderSpeakers(speakersData.opening)}
<p className="subheader">Closing Speakers</p>
{renderSpeakers(speakersData.closing)}
<p className="subheader">Panelists</p>
{renderSpeakers(speakersData.panelists)}
</div>
)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(small thing) be sure to add semicolons after statements like returns, variable declarations, etc.; it's neater with them in 😅

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for all the suggestions! I just pushed the changes so let me know if anything else needs to be changed.

}
Loading