css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

<div class="custom-boilerplate">
	<img class="logo" src="https://image.freepik.com/free-icon/github-logo_318-10832.jpg">
      <h1>Github Search</h1>
      <p class="lead">
          Search in Github repositories ...

    <div class="container">
      <div id="searchbox">
          <form id="search-form" method="#">
              <label class="sr-only" for="input-name">Name</label>
              <div class="input-group mb-2 mb-sm-0">
                  <input type="text"
                         placeholder="Insert the username to see its repos ..."
                  <button type="submit"
                        class="btn btn-primary mr-3">
      </div> <!-- // searchbox -->
    </div> <!-- // container -->
		<div id="info-results" class="container">
			<div id="results" class="row" >
			</div>  <!-- // #results --->
              body {
  padding-top: 5rem;

.custom-boilerplate {
  padding: 3rem 1.5rem;
  text-align: center;

  h1 {
    margin-bottom: 1.5rem;

#searchbox {
	margin-bottom: 2rem;

.no-results {
	size: 2rem;

.logo {
	width: 150px;
	height: 150px;

.hidden {
	display: none;

class GithubAPI {
  constructor () {
    this.elements = {
      'form': $('#search-form'),
      'input': $('#input-name'),
      'results': $('#results'),
			'resultsInfo': $('#info-results')
  } // constructtor

  callMainAPI() {
      this.elements.form.on('submit', (e) => {
				let q = this.elements.input.val().trim()
				let query = encodeURIComponent(q)

				const getPromiseAPI = fetch(`https://api.github.com/search/users?q=${query}`)
					.then((response) => response.json())
					.then((mainData) =>  {this.showMainData(mainData)} )
					.catch((error) => { console.error(error) })
  } // callMainAPI
	showMainData (mainData) {
		if (mainData == 0 ) {
			this.elements.results.append(`<p class="no-results text-center">  No puplic repos found ...  </p>`)
		 else if (mainData === undefined || mainData.message === 'Not Found') {
			 this.elements.results.append(`<p class="no-results text-center"> Ooops No results found ...  </p>`)
		else {
			<h3 class="text-center"> ${mainData.total_count} result(s) found </h3>
		mainData.items.forEach((itemMain) => {
			let userName = itemMain.login
			let pic = itemMain.avatar_url
			let userID = itemMain.id
			let userProfile = itemMain.html_url
			let reposUrl = itemMain.repos_url  // The repos url directly from the user API
			const getReposAPI = fetch(`${reposUrl}`)
					.then((response) => response.json())
					.then((data) =>   {
						console.log(data)   // move the append outside of the small for each and add an id to parent div element for appending
							<div id="${userID}" class="list-item col-sm-5 col-md-4 col-lg-3">

								<div class="thumbnail text-center">
									<img class="img-thumbnail" src="${pic}" alt="Profile Picture">

									<p class="text-center"> <b>User Name :</b> <a href="${userProfile}" target="_blank"> ${userName} </a> </p>
								</div> <!-- thumbnail -->
									<p class="user text-center"> <b>User ID :</b> ${userID} </p>
								</div> <!-- col -->
					data.forEach(repo => {
							let repoName = repo.name
							let repoID = repo.id
							let repoProfile = repo.html_url
							let appendId = '#' + userID
					<div class="list-group">
						<a href="${repoProfile}" class="list-group-item">${repoName}</a>
				})// .then
				.catch((error) => { console.error(error) })
			}) // main4each
		} //else
	} // showMainData
} // class

const git = new GithubAPI()

🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................