'use strict'
export class Render {
  static byId(content, node) {
    return (document.getElementById(node).innerHTML = content)
  }
  static byTag(content, node) {
    return (document.getElementById(node).innerHTML = content)
  }
}

export function getTechnologiesList(path) {
  let technologiesListing = ``
  for (let usedTechnology in path) {
    technologiesListing += `<li class="${path[usedTechnology].toLowerCase()}">${path[usedTechnology]}</li>`
  }
  return `<ul class="tools">${technologiesListing}</ul>`
}

export function getWorkplaceHighlights(path) {
  let highlightsListing = ``
  for (let workplaceHighlight in path) {
    highlightsListing += `<li>${path[workplaceHighlight]}</li>`
  }
  return `<ul>${highlightsListing}</ul>`
}

export function getTimespan(date, node) {
  const
    div = document.getElementById(node),
    today = new Date(),
    givenDate = new Date(date),
    month = today.getMonth() - givenDate.getMonth(),
    timespan = today.getFullYear() - givenDate.getFullYear()
  if (month < 0 || (month === 0 && today.getDate() < givenDate.getDate())) {
    return (div.innerText = timespan - 1)
  }
  return (div.innerText = timespan)
}

export function toggleElementVisibility(div) {
  const element = document.getElementById(div)
  switch (element.style.display) {
    case 'block':
      element.style.display = 'none';
      break
    default:
      element.style.display = 'block'
  }
}

export function ctaCloseMenu() {
  const menuLinks = document.querySelectorAll("#panel > li")
  let i;
  const viewportWidth = window.innerWidth || document.documentElement.clientWidth;
  if (viewportWidth < 720) {
    for (i = 0; i < menuLinks.length; i++) {
      menuLinks[i].addEventListener('click', function () {
        document.getElementById("panel").style.display = 'none'
      });
    }
  }
}
@@ -231,32 +231,29 @@
 %7D%0A%7D%0A%0Aexport 
-function
+const
  getTechnolo
@@ -264,111 +264,79 @@
 List
+ = 
 (path)
+ =%3E
  %7B%0A  
-let technologiesListing = %60%60%0A  for (let usedTechnology in path) %7B%0A    technologiesListing +=
+return %60%3Cul class=%22tools%22%3E$%7Bpath.map(usedTechnology =%3E
  %60%3Cl
@@ -346,21 +346,16 @@
 lass=%22$%7B
-path%5B
 usedTech
@@ -360,17 +360,16 @@
 chnology
-%5D
 .toLower
@@ -379,21 +379,16 @@
 e()%7D%22%3E$%7B
-path%5B
 usedTech
@@ -397,70 +397,25 @@
 logy
-%5D
 %7D%3C/li%3E%60
-%0A  %7D%0A  return %60%3Cul class=%22tools%22%3E$%7BtechnologiesListing
+).join('')
 %7D%3C/u
@@ -424,32 +424,29 @@
 %60%0A%7D%0A%0Aexport 
-function
+const
  getWorkplac
@@ -460,119 +460,77 @@
 ghts
+ = 
 (path)
+ =%3E
  %7B%0A  
-let highlightsListing = %60%60%0A  for (let workplaceHighlight in path) %7B%0A    highlightsListing +=
+return %60%3Cul%3E$%7Bpath.map(workplaceHighlight =%3E
  %60%3Cli%3E$%7B
 path
@@ -529,13 +529,8 @@
 i%3E$%7B
-path%5B
 work
@@ -547,54 +547,25 @@
 ight
-%5D
 %7D%3C/li%3E%60
-%0A  %7D%0A  return %60%3Cul%3E$%7BhighlightsListing
+).join('')
 %7D%3C/u
@@ -578,24 +578,21 @@
 %0Aexport 
-function
+const
  getTime
@@ -595,16 +595,19 @@
 Timespan
+ = 
 (date, n
@@ -606,24 +606,27 @@
 (date, node)
+ =%3E
  %7B%0A  const%0A 
@@ -837,18 +837,22 @@
 ear()%0A  
-if
+return
  (month 
@@ -914,28 +914,17 @@
 ate())) 
-%7B%0A    return
+?
  (div.in
@@ -950,21 +950,10 @@
 - 1)
-%0A  %7D%0A  return
+ :
  (di
@@ -986,24 +986,21 @@
 %0Aexport 
-function
+const
  toggleE
@@ -1015,21 +1015,27 @@
 sibility
+ = 
 (div)
+ =%3E
  %7B%0A  con
@@ -1244,24 +1244,21 @@
 %0Aexport 
-function
+const
  ctaClos
@@ -1262,18 +1262,24 @@
 loseMenu
-()
+ = () =%3E
  %7B%0A  con
@@ -1337,25 +1337,13 @@
 li%22)
+,
 %0A  
-let i;%0A  const
+ 
  vie
@@ -1414,16 +1414,25 @@
 tWidth;%0A
+  let i;%0A
   if (vi
@@ -1546,29 +1546,13 @@
 k', 
-function () %7B%0A       
+() =%3E
  doc
@@ -1607,16 +1607,8 @@
 one'
-%0A      %7D
 );%0A 

refactor utils