From ed73ffd6b1f6c299ed0ea5a314d2dbeb21327437 Mon Sep 17 00:00:00 2001 From: praptisharma28 <123169861+praptisharma28@users.noreply.github.com> Date: Mon, 17 Apr 2023 21:29:52 +0530 Subject: [PATCH] github user finder --- index.js | 28 ++++++++++++++++++++++++++++ searchbar.html | 39 +++++++++++++++++++++++++++++++++++++++ styles.css | 15 +++++++++++++++ 3 files changed, 82 insertions(+) create mode 100644 index.js create mode 100644 searchbar.html create mode 100644 styles.css diff --git a/index.js b/index.js new file mode 100644 index 0000000..090ac5e --- /dev/null +++ b/index.js @@ -0,0 +1,28 @@ +//fetch data from form! +var form = document.getElementById("myForm"); + + +form.addEventListener('submit', function (e) { + + //prevent the auto submission of form + e.preventDefault(); + + var search = document.getElementById("search").value; + + //to remove space in b/w firstName & lastName + var originalName = search.split(' ').join(''); + + document.getElementById("result").innerHTML = ''; + + fetch("https://api.github.com/users/" + originalName) + .then((result) => result.json()) + .then((data) => { + console.log(data) + + document.getElementById("result").classList.add("discription"); + + document.getElementById("result").innerHTML = ` + + ` + }) +}) \ No newline at end of file diff --git a/searchbar.html b/searchbar.html new file mode 100644 index 0000000..a4e5144 --- /dev/null +++ b/searchbar.html @@ -0,0 +1,39 @@ + + + + + + + Bootstrap demo + + + + + +
+

+

GIT USER FINDER

+ +


+
+
+ +
+
+
+ +
+
+ +
+ +
+ +
+ + + \ No newline at end of file diff --git a/styles.css b/styles.css new file mode 100644 index 0000000..6f1ad49 --- /dev/null +++ b/styles.css @@ -0,0 +1,15 @@ +*{ + justify-content: center; + align-items: center; + text-align: center; +} + +body{ + + background-image: linear-gradient(to right, #eea2a2 0%, #bbc1bf 19%, #57c6e1 42%, #b49fda 79%, #7ac5d8 100%); + +} + +h1{ + font-size: 80px; +} \ No newline at end of file