forked from bpd01001/2024-spring-dmd-3475
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
uploaded files
- Loading branch information
Showing
4 changed files
with
553 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
.container { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
background-color: #d5caf7; | ||
} | ||
|
||
h1 { | ||
color:#9e8adf; | ||
font-size: 48px; | ||
} | ||
|
||
button { | ||
background-color: #9e8adf; | ||
color: white; | ||
border: none; | ||
border-radius: 10px; | ||
width: 100px; | ||
height: 30px; | ||
font-size: 1em; | ||
} | ||
|
||
button:hover { | ||
background-color: rgb(255, 255, 255); | ||
color:#9e8adf; | ||
border:1px solid #9e8adf; | ||
} | ||
|
||
input { | ||
height: 25px; | ||
border-radius: 10px; | ||
width: 200px; | ||
border: 1px rgb(33, 33, 33) solid; | ||
padding-left: 10px; | ||
font-size: 1em; | ||
} | ||
|
||
form { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
gap: 10px; | ||
flex-direction: column; | ||
border: 1px #9e8adf; | ||
background-color: #d5caf7; | ||
} | ||
|
||
.profile { | ||
display: flex; | ||
flex-direction: column; | ||
padding: 20px 0px; | ||
align-items: center; | ||
border: solid 1px rgb(132, 132, 132); | ||
border-radius: 10px; | ||
gap: 20px; | ||
background-color: white; | ||
} | ||
|
||
.profile img { | ||
width: 300px; | ||
padding: 20px; | ||
} | ||
|
||
h2 { | ||
font-size: 2em; | ||
margin: 0; | ||
} | ||
|
||
a { | ||
font-size: 1.4em; | ||
margin: 0; | ||
} | ||
|
||
#info { | ||
display: grid; | ||
grid-template-columns: 1fr 1fr 1fr; | ||
gap: 30px; | ||
padding-top: 40px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Github Userbase</title> | ||
<link rel="stylesheet" href="index.css"> | ||
</head> | ||
<body> | ||
|
||
<div class="container"> | ||
<h1>Github UConn Profile</h1> | ||
<form id="form"> | ||
<input type="text" name="input"> | ||
<button id="button">Search</button> | ||
</form> | ||
<section id="info"> | ||
|
||
</section> | ||
</div> | ||
<script src="/index.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
let info = document.querySelector("#info"); | ||
let button = document.querySelector("#button") | ||
let form = document.querySelector("#form") | ||
|
||
form.addEventListener("submit", function (e) { | ||
e.preventDefault() | ||
|
||
info.innerHTML = `` | ||
|
||
let formData = new FormData(this); | ||
let input = formData.get("input"); | ||
|
||
fetch(`https://github.uconn.edu/api/v3/search/users?q=${input}`) | ||
.then(response => { | ||
return response.json(); | ||
}).then(items => { | ||
items.items.forEach(element => { | ||
info.innerHTML += ` | ||
<div class="profile"> | ||
<img src="${element.avatar_url}"> | ||
<h2>${element.login}</h2> | ||
<a href="${element.html_url}">Profile</a> | ||
</div>` | ||
}); | ||
}); | ||
}) | ||
|
Oops, something went wrong.