/*
Author:Murtadha Marzouq
@description: This is the main file that loads all the components
@date: 04/13/2022
*/
/****
* CREATE THE COMPONENTS AND APPEND THEM TO THE DOM
****/
/****
* LANGUAGE COMPONENTS
****/
const LanguagesComponent = () => {
let html = ''
for (i in Object.keys(information.Languages)) {
html += `
- ${information.Languages[i]}
`
}
return ` Languages:
${html}`
}
/****
* P U B L I C A T I O N S C O M P O N E N T
****/
const PublicationsComponent = () => {
let html = ''
for (i in Object.keys(information.Publications)) {
html += ``
}
return ` ๐ Publications:
${html}`
}
/**
* Objective Component
*/
const ObjectiveComponent = () => {
let html = ''
for (i in Object.keys(information.Objective)) {
let objective = information.Objective[i]
let objectiveComponent = document.createElement('div')
objectiveComponent.classList.add('objective')
objectiveComponent.innerHTML += `
${objective}
`
html += objectiveComponent.outerHTML
}
return '๐ฏ๐๏ธ Experience:
' + html
}
/****
* EDUCATION COMPONENT
****/
const EducationComponent = () => {
let html = ''
for (i in Object.keys(information.Education)) {
let education = information.Education[i]
let educationComponent = document.createElement('div')
educationComponent.classList.add('education')
educationComponent.innerHTML += `
- ${education.degree}
${education.major}
- ${education.institution}
- ${education.status} in ${education.year}
- Awarded: ${education.awards}
`
html += educationComponent.outerHTML
//document.querySelector("#column-1").appendChild(educationComponent);
}
return ` ๐ ๐ Education:
${html}`
}
const SkillsComponent = () => {
let Skills =
`Skills:
` +
information.Skills.map((skill) => {
return `
`
}).join('')
return Skills
}
const CertificationComponent = () => {
let html = ''
for (i in Object.keys(information.Certification)) {
let certification = information.Certification[i]
let certificationComponent = document.createElement('div')
certificationComponent.classList.add('certification')
certificationComponent.innerHTML += `
${certification.Certification}
Certification Year: ${certification.Date}
${certification.Describtion}
`
html += certificationComponent.outerHTML
}
return ' ๐งพ๐งพ Certification:
' + html
}
const ExperienceComponent = () => {
let html = ''
for (i in Object.keys(information.Experience)) {
let experience = information.Experience[i]
let experienceComponent = document.createElement('div')
experienceComponent.classList.add('experience')
experienceComponent.innerHTML += `
${experience.title}
${experience.company}
${experience.location} | ${experience.startDate} - ${
experience.endDate
}
Responsibilities: ${experience.Responsibilities.map(
(responsibility) => {
return `
`
},
).join('')}
`
html += experienceComponent.outerHTML
}
return '๐ข๐ฅ๏ธ๐ฝExperience:
' + html
}
const InterestComponent = () => {
let html = ''
for (i in Object.keys(information.Interests)) {
let interest = information.Interests[i]
let interestComponent = document.createElement('div')
interestComponent.classList.add('interest')
interestComponent.innerHTML += `
`
html += interestComponent.outerHTML
}
return 'Interests:
' + html
}
const NavBar = () => {
let html = ` (213)-458-4982 |`
html += ` mmarzouq@uncc.edu |`
html += ` Github |`
html += ` LinkedIn | `
html += ` Resume `
html += `Charlotte, NC
`
document.getElementById('header').innerHTML =
`${html} ` +
` ${information.Name}
`
}
/****
* @description: This function loads all the components
* @param: none
* @return: none
****/
const load = () => {
//Setting up the image
// Creating Components
let sections = Object.keys(information)
let Education = EducationComponent()
let Objective = ObjectiveComponent()
let Skills = SkillsComponent()
let Certification = CertificationComponent()
let Experience = ExperienceComponent()
let Interest = InterestComponent()
let Publications = PublicationsComponent()
let Languages = LanguagesComponent()
// Creating Elements for each section
let Firstcolumn = document.createElement('div')
let Secondcolumn = document.createElement('div')
let educatoion = document.createElement('section')
let objective = document.createElement('section')
let skills = document.createElement('section')
let certification = document.createElement('section')
let experience = document.createElement('section')
let interest = document.createElement('section')
let publications = document.createElement('section')
let languages = document.createElement('section')
// setting the sections
educatoion.innerHTML = Education
objective.innerHTML = Objective
skills.innerHTML = Skills
certification.innerHTML = Certification
experience.innerHTML = Experience
interest.innerHTML = Interest
publications.innerHTML = Publications
languages.innerHTML = Languages
// Add sections to sectionsArray
// Firstcolumn.innerHTML = `
`
Firstcolumn.appendChild(objective)
Firstcolumn.appendChild(educatoion)
Firstcolumn.appendChild(experience)
Firstcolumn.appendChild(certification)
Secondcolumn.appendChild(skills)
Secondcolumn.appendChild(interest)
Secondcolumn.appendChild(publications)
Secondcolumn.appendChild(languages)
// Creating the divider
let page = Firstcolumn.innerHTML + '
' + Secondcolumn.outerHTML
document.querySelector('.resumeText').innerHTML = page
}
var information = {}
window.onload = () => {
let url;
if(window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1' ){
let host = window.location.hostname
let port = window.location.port
url = `http://${host}:${port}/information.json`
console.log('THE URL IS LOCAL LINK' + url)
}else{
// make it the remote file
url = 'https://raw.githubusercontent.com/MurtadhaM/FindASnake/main/information.json';
console.log('THE URL IS REMOTE LINK' + url)
}
fetch(
url,
)
.then((response) => response.json())
.then((data) => {
information = data
NavBar()
load()
})
}