diff --git a/cvByUser/index.html b/cvByUser/index.html new file mode 100644 index 0000000..014f1a4 --- /dev/null +++ b/cvByUser/index.html @@ -0,0 +1,22 @@ + + + + + + Title + + +
+

Resume database

+
+
+ + + +

+ +
+ + + + \ No newline at end of file diff --git a/cvByUser/index.js b/cvByUser/index.js new file mode 100644 index 0000000..09e910c --- /dev/null +++ b/cvByUser/index.js @@ -0,0 +1,26 @@ +import { users } from './usersData.js'; +const URL='https://htmlpreview.github.io/?https://github.com/d-stuff/netcraft-03-2022/blob/main/' +const searchButton=document.querySelector('#searchBtn') +searchButton.addEventListener('click',main) + + +function searchUser(){ + const userInput =document.querySelector('#user').value + const user =users.find(user=>user.name===userInput) + + + return user + +} +function main() { + const user=searchUser() + if(user){ + const urlCV=URL+user.cv + location.href = urlCV; + } + else { + document.querySelector('#err').innerHTML='User does not exist' + + } + +} diff --git a/cvByUser/usersData.js b/cvByUser/usersData.js new file mode 100644 index 0000000..4cdad40 --- /dev/null +++ b/cvByUser/usersData.js @@ -0,0 +1,12 @@ +// const URL='https://htmlpreview.github.io/?https://github.com/d-stuff/netcraft-03-2022/blob/main/' +export const users=[ + {name:"ben-or",cv:'Ben-Or/BenOrHabariResume.html'}, + {name:"michael",cv:'Michael/index.html'}, + {name:"shaked",cv:'Shaked/index.html'}, + {name:"adi",cv:'adi/index.html'}, + {name:"david",cv:'david-levy/index.html'}, + {name:"tal",cv:'talCv/index.html'}, + {name:"yaniv",cv:'yaniv/index.html'}, + +] +