From 7cbb6d2c746124efb58d02f22194a041fae0d76c Mon Sep 17 00:00:00 2001 From: sena <48647939+msenaavci@users.noreply.github.com> Date: Sun, 2 Jun 2019 05:21:41 +0200 Subject: [PATCH 1/3] Update index.js --- homework/index.js | 67 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/homework/index.js b/homework/index.js index d3a97645e..8835bfe45 100644 --- a/homework/index.js +++ b/homework/index.js @@ -37,6 +37,73 @@ createAndAppend('div', root, { text: err.message, class: 'alert-error' }); } else { createAndAppend('pre', root, { text: JSON.stringify(data, null, 2) }); + const h1 = createAndAppend('h1', root, { + class: 'h1', + text: 'HYF Repositories', + }); + const select = createAndAppend('select', h1, { + class: 'selector', + }); + select.innerHTML = data.sort(function(a, b) { + a.name.localeCompare(b.name); + }); + for (let i = 0; i < data.length; i++) { + createAndAppend('option', select, { + text: data[i].name, + value: i, + }); + } + const createRepo = repoI => { + const container = createAndAppend('div', root); + const leftDiv = createAndAppend('div', container, { + id: 'left-div', + }); + const rightDiv = createAndAppend('div', container, { + id: 'right-div', + }); + const table1 = createAndAppend('table', leftDiv); + const trL1 = createAndAppend('tr', table1); + const link = createAndAppend('td', trL1, { + text: 'Repository:', + }); + createAndAppend('a', link, { + href: data[repoI].html_url, + target: '_blank', + text: data[repoI].name, + }); + const trL2 = createAndAppend('tr', table1); + const descriprion = createAndAppend('td', trL2, { + text: `Description: ${data[repoI].description}`, + }); + const trL3 = createAndAppend('tr', table1); + const forks = createAndAppend('td', trL3, { + text: `Forks: ${data[repoI].forks}`, + }); + const trL4 = createAndAppend('tr', table); + const update = createAndAppend('td', trL4, { + text: `Updated: ${data[repoI].updated_at}`, + }); + }; + const constributors = () => { + fetch(data[i].contributors_url) + .then(response => response.json()) + .then(data => { + const ul = createAndAppend('ul', rightDiv); + const li = createAndAppend('li', ul, { + id: 'constributor_item', + }); + createAndAppend('img', li, { + src: data[i].avatar_url, + height: '52px', + }); + const divConst = createAndAppend('div', li, { + text: data[i].login, + }); + createAndAppend('div', li, { + text: `${dataCont[i].contributions}`, + }); + }); + }; } }); } From 4fd6be898bd8949015b03bd0eec39e9f9c115eab Mon Sep 17 00:00:00 2001 From: sena <48647939+msenaavci@users.noreply.github.com> Date: Sun, 2 Jun 2019 05:22:30 +0200 Subject: [PATCH 2/3] Update index.html --- homework/index.html | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/homework/index.html b/homework/index.html index 9c8f80c1a..428114250 100644 --- a/homework/index.html +++ b/homework/index.html @@ -16,8 +16,28 @@
- - +HYF Repository