Skip to content

Commit

Permalink
Converted Speakers class to function (#240)
Browse files Browse the repository at this point in the history
  • Loading branch information
alicetran1221 authored Apr 2, 2024
1 parent c3c3e9b commit fbc5963
Showing 1 changed file with 26 additions and 34 deletions.
60 changes: 26 additions & 34 deletions src/app/components/speakers/speakers.js
Original file line number Diff line number Diff line change
@@ -1,46 +1,38 @@
import React from "react";
import React from 'react';
import { speakersData } from "assets/data/speakers-info.js";
import "./speakers.scss";

const Speaker = (name, title, photo) => {
return (
const Speaker = (name, title, photo) => (
<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>
<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>
);
};
);

const renderSpeakers = (speakers) => {
return (
const renderSpeakers = (speakers) => (
<div className="speaker-photos">
{speakers.map((speaker) =>
Speaker(speaker.name, speaker.title, speaker.photo),
)}
{speakers.map((speaker) =>
Speaker(speaker.name, speaker.title, speaker.photo)
)}
</div>
);
};
);

export default class Speakers extends React.Component {
render() {
const Speakers = () => {
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>
<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>
);
}
}

// <p className="subheader">Keynote</p>
// {renderSpeakers(speakersData.keynotes)}
export default Speakers;

0 comments on commit fbc5963

Please sign in to comment.