-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjs.js
113 lines (77 loc) · 2.22 KB
/
js.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
let users = document.querySelectorAll(".contentUsers")[0];
console.log(users)
let containerusers = document.querySelectorAll(".mainContentUsers")[0];
let imgUrl = "https://avatars2.githubusercontent.com/u/31545128?s=460&u=2c1e279b6d728d05c70b90a9739ba86f2448bf22&v=4";
let usersList = [
{
id: 1,
name: "Danilo Lima",
score: 69000
},
{
id: 2,
name: "Eric Ayuko",
score: 78670
},
{
id: 3,
name: "Erica Mendes",
score: 346
},
{
id: 4,
name: "Julio Costa",
score: 1790
},
{
id: 5,
name: "Bruna Carvalho",
score: 123560
},
{
id: 6,
name: "Alissa Santos",
score: 69000
},
{
id: 7,
name: "Bruno Almeida",
score: 23500
},
{
id: 8,
name: "Antonio da Silva",
score: 78670
},
]
function User(id,name,score){
let element = document.createElement("div");
let spanid = document.createElement("span");
spanid.textContent = id;
let spanName = document.createElement("span");
let spanUsreImg = document.createElement("img");
spanUsreImg.src = imgUrl;
let labelUserName = document.createElement("label");
labelUserName.textContent = name;
spanName.appendChild(spanUsreImg);
spanName.appendChild(labelUserName);
let spanScore = document.createElement("span");
let spanNumerbsScore = document.createElement("label");
spanNumerbsScore.textContent = score;
let spanCoreIcon = document.createElement("i");
spanCoreIcon.className = "fas fa-gem";
let spanMoreIcon = document.createElement("span");
spanMoreIcon.className = "fas fa-ellipsis-v";
spanScore.appendChild(spanNumerbsScore);
spanScore.appendChild(spanCoreIcon);
element.classList.add("contentUsers");
element.style.animationDelay = `${id - (id * 0.8)}s`;
element.appendChild(spanid);
element.appendChild(spanName);
element.appendChild(spanScore);
element.appendChild(spanMoreIcon);
return element;
}
usersList.map(user => {
containerusers.appendChild(User(user.id,user.name,user.score));
});