Add files via upload

This commit is contained in:
HarmandI 2021-10-19 12:45:24 +02:00 committed by GitHub
parent 4a8e0b3e51
commit 5f2f92b572
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 47 additions and 125 deletions

View File

@ -18,80 +18,15 @@
<section id="corps"> <section id="corps">
<h1>Our Team Members</h1> <h1>Our Team Members</h1>
<div id="blocs"> <div id="blocs">
<div id="carteidentite1">
<div>
<img
id="avatar"
src="/assets/kisspng-computer-icons-avatar-login-user-avatar-5ac207e6c8c133.5629676315226654468223.png"
alt=""
/>
</div>
<div id="personne1">
<p id="nom">Nom</p>
<p id="prenom">Prenom</p>
<p id="identifiant">Identifiant</p>
<p id="mail">Email</p>
</div>
</div>
<div id="carteidentite2">
<div>
<img
id="avatar"
src="/assets/kisspng-computer-icons-avatar-login-user-avatar-5ac207e6c8c133.5629676315226654468223.png"
alt=""
/>
</div>
<div id="personne2">
<p id="nom">Nom</p>
<p id="prenom">Prenom</p>
<p id="identifiant">Identifiant</p>
<p id="mail">Email</p>
</div>
</div>
<div id="carteidentite3">
<div>
<img
id="avatar"
src="/assets/kisspng-computer-icons-avatar-login-user-avatar-5ac207e6c8c133.5629676315226654468223.png"
alt=""
/>
</div>
<div id="personne3">
<p id="nom">Nom</p>
<p id="prenom">Prenom</p>
<p id="identifiant">Identifiant</p>
<p id="mail">Email</p>
</div>
</div>
</div> </div>
</section> </section>
</body> </body>
<footer> <footer>
<nav aria-label="pagination"> <nav aria-label="pagination">
<ul class="pagination"> <button href = "index.html">1</button>
<li> <button id= page>2</button>
<a href=""
><span aria-hidden="true">«</span
><span class="visuallyhidden"></span
></a>
</li>
<li>
<a href=""><span class="visuallyhidden"></span>1</a>
</li>
<li>
<a href="" aria-current="page"
><span class="visuallyhidden"></span>2</a
>
</li>
<li>
<a href=""
><span class="visuallyhidden"></span
><span aria-hidden="true">»</span></a
>
</li>
</ul>
</nav> </nav>
</footer> </footer>
</html> </html>

View File

@ -1,12 +1,11 @@
const AVATAR = document.getElementById("avatar");
const NOM = document.getElementById("nom");
const PRENOM = document.getElementById("prenom");
const IDENTIFIANT = document.getElementById("identifiant");
const MAIL = document.getElementById("mail");
const PERSONNE = document.getElementById("personne_suivante");
const PERSONNE = document.getElementById("blocs");
const API_URL = "https://reqres.in/api/users?"; const API_URL = "https://reqres.in/api/users?";
const API_URL_PAGE = "https://reqres.in/api/users?page=2";
const BUTTONS = document.getElementById("page");
class Identite { class Identite {
constructor(avatar, nom, prenom, identifiant, mail) { constructor(avatar, nom, prenom, identifiant, mail) {
this.avatar = avatar; this.avatar = avatar;
@ -17,23 +16,26 @@ class Identite {
} }
PersonneSuiv() { PersonneSuiv() {
PERSONNE.innerHTML += ` PERSONNE.innerHTML += `
<div>
<img <div id="personne">
id="avatar" <img id="avatar" src="${this.avatar}" alt=""/>
src="${this.avatar}" <div id="NP">
alt="" <p id="nom" >${this.nom} ${this.prenom}</p>
/>
</div>
<div id="personne1">
<p id="nom" >${this.nom}</p>
<p id="prenom">${this.prenom} </p>
<p id="identifiant"> ${this.identifiant}</p> <p id="identifiant"> ${this.identifiant}</p>
<p id="mail">${this.mail}</p> <p id="mail">${this.mail}</p>
</div>
</div>`; </div>`;
} }
} }
BUTTONS.addEventListener('click',() => {
console.log(BUTTONS.value);
const NUMERO_PAGE = BUTTONS.value;
getData(API_URL_PAGE+NUMERO_PAGE);
});
const getData = (api) => { const getData = (api) => {
fetch(api) fetch(api)
.then((resp) => { .then((resp) => {
@ -42,17 +44,17 @@ const getData = (api) => {
.then((dataUser) => { .then((dataUser) => {
console.log(dataUser); console.log(dataUser);
PERSONNE.innerHTML = '';
const PERPAGE = dataUser.per_page; const PERPAGE = dataUser.per_page;
for (i = 0; i < PERPAGE; i++) { for (let i = 0; i < PERPAGE; i++) {
AVATAR.src = dataUser.data[i].avatar; const urlAvatar = dataUser.data[i].avatar;
NOM.innerText = dataUser.data[i].last_name; const urlNOM=dataUser.data[i].last_name;
PRENOM.innerText = dataUser.data[i].first_name; const urlPRENOM=dataUser.data[i].first_name;
IDENTIFIANT.innerText = dataUser.data[i].id; const urlIDENTIFIANT=dataUser.data[i].id;
MAIL.innerText = dataUser.data[i].email; const urlMAIL = dataUser.data[i].email;
// PERSONNE.innerHTML='';
const gens = new Identite(AVATAR, NOM, PRENOM, IDENTIFIANT, MAIL); const gens = new Identite(urlAvatar, urlNOM, urlPRENOM, urlIDENTIFIANT, urlMAIL);
gens.PersonneSuiv(); gens.PersonneSuiv();
} }
}); });

View File

@ -1,4 +1,5 @@
#corps { #corps {
justify-content: space-between;
text-align: center; text-align: center;
font-family: "Mulish", sans-serif; font-family: "Mulish", sans-serif;
} }
@ -16,18 +17,19 @@
#blocs { #blocs {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
margin: auto;
flex-wrap: wrap; flex-wrap: wrap;
justify-content: space-around; justify-content: center;
width: 80%;
} }
#personne1,
#personne2, #personne {
#personne3 { justify-content: space-between;
background-color: #3d36c2;
width: 160px; width: 160px;
height: 175px; height: 175px;
margin: 50px 5px 5px 40px; margin: 50px 5px 5px 40px;
/* background: #edecfe; */ background: #edecfe;
border-radius: 10px; border-radius: 10px;
padding: 20px; padding: 20px;
font-family: "Mulish", sans-serif; font-family: "Mulish", sans-serif;
@ -36,22 +38,27 @@
font-weight: 800; font-weight: 800;
line-height: 5%; line-height: 5%;
letter-spacing: 0.3545454740524292px; letter-spacing: 0.3545454740524292px;
text-align: left; text-align: center;
display: table-cell; display: table-cell;
vertical-align: bottom; vertical-align: bottom;
} }
#nom { #nom {
font-weight: bold; font-weight: bold;
font-size: 30px; font-size: 15px;
} }
#prenom { #prenom {
font-size: medium; font-size: medium;
} }
#avatar { #avatar {
position: relative; position: relative;
/* display: flex; */ top : -40%;
left: -25%; left: -25%;
border-radius: 50%; border-radius: 50%;
margin-bottom: -20%; margin-bottom: -20%;
@ -76,26 +83,4 @@ nav {
padding-top: 0.5em; padding-top: 0.5em;
} }
.pagination {
list-style: none;
margin: 0;
padding: 0;
display: flex;
}
.pagination li {
margin: 0 1px;
}
.pagination a {
display: block;
padding: 0.5em 1em;
border: 1px solid #999;
border-radius: 0.2em;
text-decoration: none;
}
.pagination a[aria-current="page"] {
background-color: #333;
color: #fff;
}