Week2 by Prasamsha15 · Pull Request #3 · Prasamsha15/JavaScript3 · GitHub
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 69 additions & 22 deletions Week1/MAKEME.md
Binary file added Week1/assets/create_pr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Week1/assets/eslint_autofix.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Week1/assets/eslint_install.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Week1/assets/eslint_view_errors.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions homework/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* eslint-disable no-console */
function createNode(element) {
return document.createElement(element);
}
function append(parent, el) {
return parent.appendchild(el);
}
const select = document.getElementById('repositories');
const url = ('https://api.github.com/orgs/HackYourFuture/repos?per_page=100');
fetch(url)
.then(response => response.json())
.then(() => {
const repositories = select.results;
// eslint-disable-next-line array-callback-return
return repositories.map((repository) => {
const option = createNode('option');
option.innerHtml = `${repository.value}`;
append(select, option);
});
})
.catch((error) => {
console.log(JSON.stringify(error));
});
40 changes: 40 additions & 0 deletions homework/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" type="text/css" href="main.css">
<title>Javascript3</title>
</head>

<body>
<div>
<header class="header">
<div class="container">
<h1>HYF Repositories</h1>
<select id="repositories" class="repo-selector">
<option>Please choose a option </option>
</select>
</div>
</header>
<div id="main" class="container">
<div class="left-div whiteframe repo-properties">
<div><label>Repository:</label> <span id="repo-name"></span></div>
<div><label>Description:</label> <span id="repo-description"></span></div>
<div><label>Forks:</label> <span id="repo-forks"></span></div>
<div><label>Updated:</label> <span id="repo-updated"></span></div>
</div>
<div class="right-div whiteframe">
<p class="contributor-header">Contributors</p> <span id="contributorElements"></span>
<p class="username"></p>
<p class="repos"></p>
<p class="avatar"></p>
</div>
</div>
</div>
<script src="index1.js"></script>
</body>

</html>
28 changes: 28 additions & 0 deletions homework/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const repoSelectElement = document.getElementById('repositories');
const unContainer = document.querySelector('.right__div-username');
const reposContainer = document.querySelector('.right__div-repos');
const avatarContainer = document.querySelector('.right__div-avatar');

const CONTRIBUTORS_URL = async () => {
const API_CALL = await fetch(
'https://api.github.com/repos/HackYourFuture/tdd-game/contributors',
);
const data = await API_CALL.json();
return {
data,
};
};
const showContributorsDetails = () => {
CONTRIBUTORS_URL(repoSelectElement.value).then((response) => {
unContainer.innerHTML = `username:<span class="right_div-value">${
response.data.login
}</span>`;
reposContainer.innerHTML = `Repos:<span class="right_div-value"> ${
response.data.repos_url
}</span>`;
avatarContainer.innerHTML = `<span class="right_div-value">${
response.data.avatar_url
}</span>`;
});
};
showContributorsDetails();
69 changes: 69 additions & 0 deletions homework/index1.js
Loading