-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathui.js
139 lines (99 loc) · 4.22 KB
/
ui.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
class UI {
constructor(){
this.profileDiv = document.getElementById("profile")
this.repoDiv = document.getElementById("repos")
this.lastUsers = document.getElementById("last-users")
this.inputFiled = document.getElementById("githubname")
this.cardBody = document.querySelector(".card-body")
this.orgsDiv = document.getElementById("organization")
}
clearInput(){
this.inputFiled.value = "";
}
ShowUserInfo(user){
this.profileDiv.innerHTML = `
<div class="row">
<div class="card card-body mb-3">
<div class="row">
<div class="col-md-4">
<a href="${user.html_url}" target = "_blank">
<img class="img-fluid mb-2" src="${user.avatar_url}"> </a>
<hr>
<div id="fullName"><strong>${user.name}</strong></div>
<hr>
<div id="bio">${user.bio}</div>
</div>
<div class="col-md-8">
<button class="btn btn-secondary">
Takipçi <span class="badge badge-light">${user.followers}</span>
</button>
<button class="btn btn-info">
Takip Edilen <span class="badge badge-light">${user.following}</span>
</button>
<button class="btn btn-danger">
Repolar <span class="badge badge-light">${user.public_repos}</span>
</button>
<hr>
<li class="list-group">
<li class="list-group-item borderzero">
<img src="https://img.icons8.com/ios-filled/30/undefined/company.png"/><span id="company">${user.company}</span>
</li>
<li class="list-group-item borderzero">
<img src="https://img.icons8.com/ios-glyphs/30/undefined/marker--v1.png"/> <span id = "location">${user.location}</a>
</li>
<li class="list-group-item borderzero">
<img src="https://img.icons8.com/ios-glyphs/30/undefined/twitter--v1.png"/> <span id="mail">${user.twitter_username}</span>
</li>
</div>
</div>
</div>
`
}
showErrorMessage(message) {
const div = document.createElement('div');
div.className="alert alert-danger";
div.textContent=message;
this.cardBody.appendChild(div);
setTimeout(() => {
div.remove();
},3000)
}
showorgs(orgs){
console.log(orgs , "asdasdasd");
this.orgsDiv.innerHTML=` <div class="card-body mb-2">
<div class="row">
<div class="col-md-6">
Organizations Adı : <span>${orgs[0].login}</span>
<img width="100"src="${orgs[0].avatar_url}" alt="">
</div> <br>
<br>
<div class="col-md-6">
description : <span>${orgs[0].description}</span>
</div>
</div>
</div>`
}
showRepoInfo(repos){
this.repoDiv.innerHTML="";
repos.forEach(repo=>{
this.repoDiv.innerHTML+=`
<div class="mb-2 card-body">
<div class="row">
<div class="col-md-2">
<span></span>
<a href="${repo.html_url}" target = "_blank" id = "repoName">${repo.name}</a>
</div>
<div class="col-md-6">
<button class="btn btn-secondary">
Starlar <span class="badge badge-light" id="repoStar">${repo.stargazers_count}</span>
</button>
<button class="btn btn-info">
Forklar <span class="badge badge-light" id ="repoFork">${repo.forks_count}</span>
</button>
${repo.language}
</div>
</div>
</div`
})
}
}