This project is a simple web application that allows users to search for GitHub profiles and view repositories. The application is built using HTML, CSS, and JavaScript, and it utilizes the GitHub API to fetch user data.
-
User Search: Users can input a GitHub username in the search bar and click the search button to fetch and display the user's repositories.
-
User Details: The application displays essential user details, including the user's avatar, name, location, and Twitter handle.
-
Pagination: Users can navigate through multiple pages of repositories using the pagination buttons.
To run the application, follow these steps:
-
Clone the repository to your local machine.
git clone https://github.com/utkarshml/Fly.git
-
Open the
index.html
file in a web browser.
-
Open the application in your web browser.
-
Enter a GitHub username in the search bar.
-
Click the search button to fetch and display the user's repositories.
-
Explore the user's details and repositories.
-
HTML: The structure of the web page is defined in the
index.html
file. -
CSS: Styling is applied using the
style.css
file in thepublic/styles
directory. External styles from the Unicons library are also used. -
JavaScript: The functionality of the application is implemented in the
fetch.js
file. It handles user input, fetches data from the GitHub API, and dynamically updates the UI.
- Unicons: Used for including icons in the application.
The application uses the GitHub API to fetch user repositories. The API request is triggered when the user clicks the search button, and the fetched data is displayed on the page.
const inputValue = document.getElementById("search");
const btn = document.getElementById("searchBtn");
btn.addEventListener("click", (e) => {
e.preventDefault()
let value = inputValue.value;
fetch(`https://api.github.com/users/${value}/repos`)
.then((data) => {
if(data.status != 200){
throw Error()
}
else{
return data.json()
}
})
.then((data) => {
window.localStorage.setItem("token" , value)
window.localStorage.setItem("len" , data.length)
window.location.href = `user.html`
})
.catch((err) => {
alert("User Not Found");
})
})
If you encounter any issues or have suggestions for improvements, please open an issue on the GitHub repository.
- Utkarsh - GitHub Profile
Feel free to contribute to the project and make it even better!