-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.js
31 lines (27 loc) · 1021 Bytes
/
main.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
import './style.css'
import { fetchProfile } from './profile.js'
import whoami from './typing.js'
const username = 'gdsclpu';
const data = await fetchProfile(username);
document.querySelector('#app').innerHTML = `
<div>
<a href="${data?.html_url}" target="_blank">
<img src="https://github.com/${username}.png" class="logo vanilla img-size" alt="JavaScript logo" />
</a>
<h1 id="whoami"></h1>
<p>${data?.bio}</p>
<div class="card">
<button id="redictToProfile" type="button">Checkout my profile</button>
</div>
<p class="profile-data">
<strong>Followers:</strong> ${data?.followers} <br />
<strong>Followings:</strong> ${data?.following} <br />
<strong>Repos:</strong> ${data?.public_repos} <br />
<strong>On github since:</strong> ${new Date(data?.created_at).toLocaleDateString()} <br />
</p>
</div>
`
document.getElementById('redictToProfile').addEventListener('click', () => {
window.location.href = `${data?.html_url}`
})
whoami(username)