Skip to content

Commit 04b5d8c

Browse files
mrtysnclaude
andcommitted
Wire containers to context and convert to function components
Experience, Education, and SectionTitle converted from class to function components. All containers now consume CVContext and filter data through processData before rendering. SectionTitle accepts children for inline toggle controls. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 4d16639 commit 04b5d8c

File tree

6 files changed

+86
-71
lines changed

6 files changed

+86
-71
lines changed

Mert_Yasin_CV.pdf

0 Bytes
Binary file not shown.

src/components/SectionTitle.js

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
import React from "react";
22
import { Divider, Header } from "semantic-ui-react";
33

4-
class SectionTitle extends React.Component {
5-
render() {
6-
return (
7-
<div>
8-
<Header
9-
as="h2"
10-
style={{ marginTop: "1em", marginBottom: 0 }}
11-
className={"fontSectionHeader colorSectionItem"}
12-
>
13-
{this.props.title}
14-
</Header>
15-
<Divider style={{ marginTop: 0, marginBottom: 0 }} />
16-
</div>
17-
);
18-
}
19-
}
4+
const SectionTitle = ({ title, children }) => {
5+
return (
6+
<div>
7+
<Header
8+
as="h2"
9+
style={{ marginTop: "1em", marginBottom: 0 }}
10+
className={"fontSectionHeader colorSectionItem"}
11+
>
12+
{title}
13+
{children}
14+
</Header>
15+
<Divider style={{ marginTop: 0, marginBottom: 0 }} />
16+
</div>
17+
);
18+
};
2019

2120
export default SectionTitle;

src/containers/Achievements.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
import React from "react";
22
import { List } from "semantic-ui-react";
33
import SectionTitle from "../components/SectionTitle";
4+
import { useCVContext } from "../context/CVContext";
5+
import { processData } from "../utils/filterData";
46
import achievementsData from "../data/achievements.json";
57

68
const renderContent = (item) => {
79
if (!item.links) {
8-
// Simple content, just parse HTML tags
910
return <span dangerouslySetInnerHTML={{ __html: item.content }} />;
1011
}
1112

12-
// Handle content with links
1313
let content = item.content;
14-
15-
// Replace {linkText} placeholders with actual links
14+
1615
Object.entries(item.links).forEach(([linkText, linkData]) => {
1716
const classNameAttr = linkData.className && linkData.className.trim() ? ` class="${linkData.className}"` : '';
1817
const linkElement = `<a href="${linkData.url}" target="_blank" rel="noopener noreferrer"${classNameAttr}>${linkText}</a>`;
@@ -23,12 +22,15 @@ const renderContent = (item) => {
2322
};
2423

2524
const Achievements = () => {
26-
if (achievementsData && achievementsData.length > 0) {
25+
const { state } = useCVContext();
26+
const data = processData(achievementsData, state);
27+
28+
if (data && data.length > 0) {
2729
return (
2830
<div>
2931
<SectionTitle title={"EXTRACURRICULAR"} />
3032
<List bulleted>
31-
{achievementsData.map((item, ix) => {
33+
{data.map((item, ix) => {
3234
return (
3335
<List.Item key={ix} className={"px12"}>
3436
{renderContent(item)}

src/containers/Education.js

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,38 @@
11
import React from "react";
22
import SectionItem from "../components/SectionItem";
33
import SectionTitle from "../components/SectionTitle";
4+
import SectionToggle from "../components/SectionToggle";
5+
import { TAGS } from "../constants/tags";
6+
import { useCVContext } from "../context/CVContext";
47
import educationData from "../data/education.json";
8+
import { processEducationData } from "../utils/filterData";
59
import { renderInstitutionTitle, renderEducationItems, renderJobTitle } from "../utils/educationRenderer";
610

7-
class Education extends React.Component {
8-
render() {
9-
return (
10-
<div>
11-
<SectionTitle title={"EDUCATION"} />
12-
{educationData.map((education, index) => {
13-
return (
14-
<SectionItem
15-
key={index}
16-
companyTitle={renderInstitutionTitle(education.institution, education.program)}
17-
location={education.location}
18-
jobTitle={renderJobTitle(education)}
19-
startDate={education.startDate}
20-
endDate={education.endDate}
21-
items={renderEducationItems(education)}
22-
relevantItems={education.relevantCourses}
23-
/>
24-
);
25-
})}
26-
</div>
27-
);
28-
}
11+
function Education() {
12+
const { state } = useCVContext();
13+
const data = processEducationData(educationData, state);
14+
15+
return (
16+
<div>
17+
<SectionTitle title={"EDUCATION"}>
18+
<SectionToggle tag={TAGS.COURSEWORK} label="courses" />
19+
</SectionTitle>
20+
{data.map((education, index) => {
21+
return (
22+
<SectionItem
23+
key={index}
24+
companyTitle={renderInstitutionTitle(education.institution, education.program)}
25+
location={education.location}
26+
jobTitle={renderJobTitle(education)}
27+
startDate={education.startDate}
28+
endDate={education.endDate}
29+
items={renderEducationItems(education)}
30+
relevantItems={education.relevantCourses}
31+
/>
32+
);
33+
})}
34+
</div>
35+
);
2936
}
3037

31-
export default Education;
38+
export default Education;

src/containers/Experience.js

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,37 @@
11
import React from "react";
22
import SectionItem from "../components/SectionItem";
33
import SectionTitle from "../components/SectionTitle";
4+
import { useCVContext } from "../context/CVContext";
45
import experienceData from "../data/experience.json";
6+
import { processData } from "../utils/filterData";
57
import { renderCompanyTitle, renderResponsibility } from "../utils/experienceRenderer";
68

7-
class Experience extends React.Component {
8-
render() {
9-
return (
10-
<div>
11-
<SectionTitle title={"EXPERIENCE"} />
12-
{experienceData.map((experience, index) => {
13-
const items = experience.responsibilities.map((responsibility, idx) =>
14-
renderResponsibility(responsibility, experience.links || {})
15-
);
9+
function Experience() {
10+
const { state } = useCVContext();
11+
const data = processData(experienceData, state);
1612

17-
return (
18-
<SectionItem
19-
key={index}
20-
companyTitle={renderCompanyTitle(experience.company)}
21-
location={experience.location}
22-
jobTitle={experience.position}
23-
startDate={experience.startDate}
24-
endDate={experience.endDate}
25-
items={items}
26-
/>
27-
);
28-
})}
29-
</div>
30-
);
31-
}
13+
return (
14+
<div>
15+
<SectionTitle title={"EXPERIENCE"} />
16+
{data.map((experience, index) => {
17+
const items = experience.responsibilities.map((responsibility, idx) =>
18+
renderResponsibility(responsibility, experience.links || {})
19+
);
20+
21+
return (
22+
<SectionItem
23+
key={index}
24+
companyTitle={renderCompanyTitle(experience.company)}
25+
location={experience.location}
26+
jobTitle={experience.position}
27+
startDate={experience.startDate}
28+
endDate={experience.endDate}
29+
items={items}
30+
/>
31+
);
32+
})}
33+
</div>
34+
);
3235
}
3336

3437
export default Experience;

src/containers/Skills.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,19 @@ import React from "react";
22
import { Grid } from "semantic-ui-react";
33
import SectionTitle from "../components/SectionTitle";
44
import { SkillRow } from "../components/SkillRow";
5+
import { useCVContext } from "../context/CVContext";
56
import useWindowSize from "../utils/useWindowSize";
7+
import { processData } from "../utils/filterData";
68
import skillsData from "../data/skills.json";
79

810
function Skills() {
11+
const { state } = useCVContext();
12+
const data = processData(skillsData, state);
913
const isNarrow = useWindowSize().width < 450;
1014
const titleColumnWidth = 3;
1115
const dataColumnWidth = 13;
1216
const className = "px12";
13-
17+
1418
return (
1519
<div>
1620
<SectionTitle title={"SKILLS"} />
@@ -20,7 +24,7 @@ function Skills() {
2024
className={className}
2125
stackable={isNarrow}
2226
>
23-
{skillsData.map((skillCategory, index) => (
27+
{data.map((skillCategory, index) => (
2428
<SkillRow
2529
key={index}
2630
titleColumnWidth={titleColumnWidth}

0 commit comments

Comments
 (0)