-
Notifications
You must be signed in to change notification settings - Fork 0
/
solution.html
78 lines (70 loc) · 1.85 KB
/
solution.html
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
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.css">
</head>
<body>
<div id="app" class="ui container">
<h1>GitHub Profiles</h1>
<div class="ui cards">
<github-user-card
v-for="username in usernames"
:username="username"
></github-user-card>
</div>
</div>
<script type="text/x-template" id="github-user-card-template">
<div class="ui card">
<div class="image">
<img :src="user.avatar_url">
</div>
<div class="content">
<a :href="`https://github.com/${username}`" class="header">{{user.name}}</a>
<div class="meta">
<span class="date">Joined in {{user.created_at}}</span>
</div>
<div class="description">
{{user.bio}}
</div>
</div>
<div class="extra content">
<a :href="`https://github.com/${username}?tab=followers`">
<i class="user icon"></i>
{{user.followers}} Friends
</a>
</div>
</div>
</script>
<!-- Import Vue.js and axios -->
<script src="https://unpkg.com/[email protected]"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<!-- Your JavaScript Code :) -->
<script>
Vue.component('github-user-card', {
template: '#github-user-card-template',
props: {
username: {
type: String,
required: true
}
},
data() {
return {
user: {}
}
},
created() {
axios.get(`https://api.github.com/users/${this.username}`)
.then(response => {
this.user = response.data
})
}
})
new Vue({
el: '#app',
data: {
usernames: ['hootlex', 'rahaug', 'sdras', 'akryum', 'alu0101102726', 'crguezl' ]
}
})
</script>
</body>
</html>