diff --git a/githubfinder/ui.js b/githubfinder/ui.js index 49e7460..b53bc83 100644 --- a/githubfinder/ui.js +++ b/githubfinder/ui.js @@ -1,6 +1,20 @@ class UI { constructor() { - this.profile = document.getElementById('profile'); + this.profile = document.getElementById("profile"); + this.months = [ + "Jan", + "Feb", + "March", + "April", + "May", + "June", + "July", + "August", + "Sept", + "Oct", + "Nov", + "Dec", + ]; } // Display profile in UI @@ -10,20 +24,45 @@ class UI {
- View Profile + View Profile
- Public Repos: ${user.public_repos} - Public Gists: ${user.public_gists} - Followers: ${user.followers} + Public Repos: ${ + user.public_repos + } + Public Gists: ${ + user.public_gists + } + Followers: ${ + user.followers + } Following: ${user.following}

+
+ Available for hire : ${user.hireable ? "Yes" : "No"} + ${ + user.twitter_username + ? `Follow on Twitter` + : "" + }
@@ -34,9 +73,9 @@ class UI { // Show user repos showRepos(repos) { - let output = ''; + let output = ""; - repos.forEach(function(repo) { + repos.forEach(function (repo) { output += `
@@ -54,7 +93,7 @@ class UI { }); // Output repos - document.getElementById('repos').innerHTML = output; + document.getElementById("repos").innerHTML = output; } // Show alert message @@ -62,15 +101,15 @@ class UI { // Clear any remaining alerts this.clearAlert(); // Create div - const div = document.createElement('div'); + const div = document.createElement("div"); // Add classes div.className = className; // Add text div.appendChild(document.createTextNode(message)); // Get parent - const container = document.querySelector('.searchContainer'); + const container = document.querySelector(".searchContainer"); // Get search box - const search = document.querySelector('.search'); + const search = document.querySelector(".search"); // Insert alert container.insertBefore(div, search); @@ -82,15 +121,15 @@ class UI { // Clear alert message clearAlert() { - const currentAlert = document.querySelector('.alert'); + const currentAlert = document.querySelector(".alert"); - if(currentAlert){ + if (currentAlert) { currentAlert.remove(); } } // Clear profile clearProfile() { - this.profile.innerHTML = ''; + this.profile.innerHTML = ""; } }