diff --git a/src/App.js b/src/App.js
index a99f38c84..19daf6bd1 100644
--- a/src/App.js
+++ b/src/App.js
@@ -1,4 +1,4 @@
-import React, { Component } from "react";
+import React, { useCallback, useEffect, useState } from "react";
import $ from "jquery";
import "./App.scss";
import Header from "./components/Header";
@@ -8,135 +8,127 @@ import Experience from "./components/Experience";
import Projects from "./components/Projects";
import Skills from "./components/Skills";
-class App extends Component {
+const App = () => {
- constructor(props) {
- super();
- this.state = {
- foo: "bar",
- resumeData: {},
- sharedData: {},
- };
- }
+ const [resumeData, setResumeData] = useState({});
+ const [sharedData, setSharedData] = useState({});
- applyPickedLanguage(pickedLanguage, oppositeLangIconId) {
- this.swapCurrentlyActiveLanguage(oppositeLangIconId);
- document.documentElement.lang = pickedLanguage;
- var resumePath =
- document.documentElement.lang === window.$primaryLanguage
- ? `res_primaryLanguage.json`
- : `res_secondaryLanguage.json`;
- this.loadResumeFromPath(resumePath);
- }
-
- swapCurrentlyActiveLanguage(oppositeLangIconId) {
- var pickedLangIconId =
- oppositeLangIconId === window.$primaryLanguageIconId
- ? window.$secondaryLanguageIconId
- : window.$primaryLanguageIconId;
- document
- .getElementById(oppositeLangIconId)
- .removeAttribute("filter", "brightness(40%)");
- document
- .getElementById(pickedLangIconId)
- .setAttribute("filter", "brightness(40%)");
- }
-
- componentDidMount() {
- this.loadSharedData();
- this.applyPickedLanguage(
- window.$primaryLanguage,
- window.$secondaryLanguageIconId
- );
- }
-
- loadResumeFromPath(path) {
+ const loadSharedData = useCallback(() => {
$.ajax({
- url: path,
+ url: `portfolio_shared_data.json`,
dataType: "json",
cache: false,
success: function (data) {
- this.setState({ resumeData: data });
- }.bind(this),
+ setSharedData(data);
+ document.title = `${sharedData.basic_info?.name}`;
+ },
error: function (xhr, status, err) {
alert(err);
},
});
- }
+ }, [sharedData, setSharedData]);
- loadSharedData() {
+ const loadResumeFromPath = useCallback((path) => {
$.ajax({
- url: `portfolio_shared_data.json`,
+ url: path,
dataType: "json",
cache: false,
success: function (data) {
- this.setState({ sharedData: data });
- document.title = `${this.state.sharedData.basic_info.name}`;
- }.bind(this),
+ setResumeData(data);
+ },
error: function (xhr, status, err) {
alert(err);
},
});
- }
+ }, [setResumeData]);
+
+ const swapCurrentlyActiveLanguage = useCallback((oppositeLangIconId) => {
+ var pickedLangIconId =
+ oppositeLangIconId === window.$primaryLanguageIconId
+ ? window.$secondaryLanguageIconId
+ : window.$primaryLanguageIconId;
+ document
+ .getElementById(oppositeLangIconId)
+ .removeAttribute("filter", "brightness(40%)");
+ document
+ .getElementById(pickedLangIconId)
+ .setAttribute("filter", "brightness(40%)");
+ }, []);
- render() {
- return (
-
-
-
-
- this.applyPickedLanguage(
- window.$primaryLanguage,
- window.$secondaryLanguageIconId
- )
- }
- style={{ display: "inline" }}
- >
-
-
-
- this.applyPickedLanguage(
- window.$secondaryLanguage,
- window.$primaryLanguageIconId
- )
- }
- style={{ display: "inline" }}
- >
-
-
+ const applyPickedLanguage = useCallback((pickedLanguage, oppositeLangIconId) => {
+ swapCurrentlyActiveLanguage(oppositeLangIconId);
+ document.documentElement.lang = pickedLanguage;
+ var resumePath =
+ document.documentElement.lang === window.$primaryLanguage
+ ? `res_primaryLanguage.json`
+ : `res_secondaryLanguage.json`;
+ loadResumeFromPath(resumePath);
+ }, [swapCurrentlyActiveLanguage, loadResumeFromPath]);
+
+ useEffect(() => {
+ loadSharedData();
+ applyPickedLanguage(
+ window.$primaryLanguage,
+ window.$secondaryLanguageIconId
+ );
+ }, []);
+
+ return (
+
+
+
+
+ applyPickedLanguage(
+ window.$primaryLanguage,
+ window.$secondaryLanguageIconId
+ )
+ }
+ style={{ display: "inline" }}
+ >
+
+
+
+ applyPickedLanguage(
+ window.$secondaryLanguage,
+ window.$primaryLanguageIconId
+ )
+ }
+ style={{ display: "inline" }}
+ >
+
-
-
-
-
-
- );
- }
+
+
+
+
+
+
+ );
}
export default App;
diff --git a/src/components/About.js b/src/components/About.js
index c7ff9bbad..b972a9604 100644
--- a/src/components/About.js
+++ b/src/components/About.js
@@ -1,95 +1,93 @@
-import React, { Component } from "react";
+import React from "react";
import { Icon } from "@iconify/react";
import angularIcon from "@iconify/icons-logos/angular-icon";
import reactIcon from "@iconify/icons-logos/react";
import vueIcon from "@iconify/icons-logos/vue";
-class About extends Component {
- render() {
- if (this.props.sharedBasicInfo) {
- var profilepic = "images/" + this.props.sharedBasicInfo.image;
- }
- if (this.props.resumeBasicInfo) {
- var sectionName = this.props.resumeBasicInfo.section_name.about;
- var hello = this.props.resumeBasicInfo.description_header;
- var about = this.props.resumeBasicInfo.description;
- }
+const About = ({sharedBasicInfo, resumeBasicInfo}) => {
+ if (sharedBasicInfo) {
+ var profilepic = "images/" + sharedBasicInfo.image;
+ }
+ if (resumeBasicInfo) {
+ var sectionName = resumeBasicInfo.section_name.about;
+ var hello = resumeBasicInfo.description_header;
+ var about = resumeBasicInfo.description;
+ }
- return (
-
-
-
- {sectionName}
-
-
-
-
-
-
-
-
-
-
-
+ return (
+
+
+
+ {sectionName}
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
- {" "}
- {" "}
- {" "}
- {" "}
-
-
-
-
- {hello} :)
-
-
- {about}
-
+
+
+
+
+ {" "}
+ {" "}
+ {" "}
+ {" "}
+
+
+
+
+ {hello} :)
+
+
+ {about}
-
- );
- }
+
+
+ );
}
export default About;
diff --git a/src/components/Experience.js b/src/components/Experience.js
index 6e40f620d..3bd5f1f6a 100644
--- a/src/components/Experience.js
+++ b/src/components/Experience.js
@@ -1,4 +1,4 @@
-import React, { Component } from "react";
+import React from "react";
import {
VerticalTimeline,
VerticalTimelineElement,
@@ -6,91 +6,89 @@ import {
import "react-vertical-timeline-component/style.min.css";
import Badge from "react-bootstrap/Badge";
-class Experience extends Component {
- render() {
- if (this.props.resumeExperience && this.props.resumeBasicInfo) {
- var sectionName = this.props.resumeBasicInfo.section_name.experience;
- var work = this.props.resumeExperience.map(function (work, i) {
- const technologies = work.technologies;
- const mainTechnologies = work.mainTech;
+const Experience = ({resumeExperience, resumeBasicInfo}) => {
+ if (resumeExperience && resumeBasicInfo) {
+ var sectionName = resumeBasicInfo.section_name.experience;
+ var work = resumeExperience.map(function (work, i) {
+ const technologies = work.technologies;
+ const mainTechnologies = work.mainTech;
- var mainTech = mainTechnologies.map((technology, i) => {
- return (
-
- {technology}
-
- );
- });
- var tech = technologies.map((technology, i) => {
- return (
-
- {technology}
-
- );
- });
+ var mainTech = mainTechnologies.map((technology, i) => {
return (
+
+ {technology}
+
+ );
+ });
+ var tech = technologies.map((technology, i) => {
+ return (
+
+ {technology}
+
+ );
+ });
+ return (
+
}
+ key={i}
+ >
+
+ {mainTech}
+
+
+
+ {work.title}
+
+
+ {work.company}
+
+ {tech}
+
+ );
+ });
+ }
+
+ return (
+
+
+
+
+
+ {sectionName}
+
+
+
+
+
+
+ {work}
}
- key={i}
- >
-
- {mainTech}
-
-
-
- {work.title}
-
-
- {work.company}
-
- {tech}
-
- );
- });
- }
-
- return (
-
-
-
-
-
- {sectionName}
-
-
-
-
-
-
- {work}
-
- }
- />
-
-
-
- );
- }
+ icon={
+
+ }
+ />
+
+
+
+ );
}
export default Experience;
diff --git a/src/components/Footer.js b/src/components/Footer.js
index 00b28970f..3c6a306eb 100644
--- a/src/components/Footer.js
+++ b/src/components/Footer.js
@@ -1,38 +1,36 @@
-import React, { Component } from "react";
+import React from "react";
-class Footer extends Component {
- render() {
- if (this.props.sharedBasicInfo) {
- var networks = this.props.sharedBasicInfo.social.map(function (network) {
- return (
-
-
-
-
-
- );
- });
- }
+const Footer = ({sharedBasicInfo}) => {
+ if (sharedBasicInfo) {
+ var networks = sharedBasicInfo.social.map(function (network) {
+ return (
+
+
+
+
+
+ );
+ });
+ }
- return (
-