Pen Settings

HTML

CSS

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

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="style.css" type="text/css" />
  <link rel="preconnect" href="https://fonts.googleapis.com" />
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
  <link href="https://fonts.googleapis.com/css2?family=Space+Mono:ital,wght@0,400;0,700;1,400&display=swap" rel="stylesheet" />
  <!-- font awesome -->
  <script src="https://kit.fontawesome.com/9c7b12afd5.js" crossorigin="anonymous"></script>
  <title>Github User Finder</title>
  </header>
  <main>
    <!-- Search Form -->
    <form id='form'>
      <div class='container'>
        <div class='form-group'>
          <input type='text' placeholder='Search Github Username' class="username" />
          <button type='submit' class='submit-btn'>
            <img src="https://raw.githubusercontent.com/FesoQue/Github-Dev-Finder/e45d38368d78ded8f5807dbf19be32702c7fd034/src/images/icon-search.svg" alt='search_icon' />
          </button>
        </div>
      </div>
    </form>
    <!-- output -->
    <article class="user-profile">
      <ul class="cards container">
      </ul>
    </article>
    <!--repo modal-->
    <div class="repo">
      <div class="modal container">
        <header>
          <h3>Repositories</h3>
          <span>
            <i class="fas fa-times 2x"></i></i>
          </span>
        </header>
        <!--content-->
        <div class="repo">
          <div class="content">
            <!--<ul class="repo-cards container">
             <li class="repo-card">
                <h4>Github Dev Finder</h3>
                <a class="repo-link" href="#">view on github</a>
                <div class="lang">
                  <p>JavaScript</p>
                  <p>HTML</p>
                  <p>CSS</p>
                </div>
                <div class="card-footer">
                 <div class="child-a">
                  <div class="img-wrap">
                   <img class="img" src="" alt="" />
                   </div>
                   <p>12/3/56</p>
                 </div>
                 <div class="child-b">
                   👍
                   <p>2</p>
                 </div>
                </div>
              </li>-->
            </ul>
          </div>
        </div>
      </div>
    </div>
    <main>
      <script src="App.js" type="text/javascript" charset="utf-8"></script>
      </body>

</html>
              
            
!

CSS

              
                *,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
h1, h2, h3, h4 {
  margin-bottom: 0;
  padding-bottom: 0;
}
li {
  list-style: none;
}
img {
  max-width: 100%;
}
body {
  font-family: 'Space Mono', monospace, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
main {
  position: relative;
}
.container {
  width: 95%;
  max-width: 800px;
  margin: 0 auto;
}
form {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100px;
  background-color: #0079ff;
}
.form-group {
  width: 100%;
  display: flex;
  justify-content: space-between;
  margin: 0 auto;
  align-items: center;
  background-color: #fff;
  border: 2px solid transparent;
  border-radius: 40px;
  transition: border 0.3s ease-out;
}
.form-group.error {
  border: 2px solid pink;
}
input,
button {
  border: 0;
  outline: 0;
}
input {
  width: 90%;
  padding: 10px;
  border-radius: 40px;
  caret-color: #0079ff;
}
.submit-btn {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 50px;
  height: 50px;
  background: none;
  background-color: #0079ff;
  color: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 2px rgba(0, 0, 0, 0.1);
  cursor: pointer;
}
button img {
  width: 29px;
}
.user-profile {
  margin-top: 2rem;
}
.card {
  padding: 14px;
  text-align: center;
  line-height: 2;
  outline: 1px solid blue;
 margin-bottom: 1rem;
}
.btn {
  display: inline-block;
  min-width: 13ch;
  padding: 8px 0;
  background: none;
  background-color: blue;
  border-radius: 8px;
  color: #fff;
}

.modal {
  position: fixed;
  top: 100px;
  left: 0;
  right: 0;
  bottom: 0;
  min-width: 80%;
 /* max-height: 100%;
  overflow-y: auto;*/
 margin: 0 auto;
  background-color: #ccc;
  display: none;
}

.show-modal {
  display: block;
}
.modal header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: center;
  padding: 15px;
  background-color: #bbb;
}
.repo {
  max-height: 100%;
  overflow-y: auto;
  height: 100%;
  padding-bottom: 40px;
}
.repo-cards {
  margin: 2rem 0;
  padding: 8px;
  box-shadow: rgba(0, 0, 0, 0.02) 0px 1px 3px 0px, rgba(27, 31, 35, 0.15) 0px 0px 0px 1px;
}
.repo-link {
  display: inline-block;
  margin: 10px 0;
}
.lang {
  display: flex;
}
.lang p {
  padding: 2px;
  font-size: 12px;
  color: #fff;
}
.lang p:nth-child(1) {
  background-color: yellow;
  color: #333;
}
.lang p:nth-child(2) {
  background-color: crimson;
  margin: 0 3px;
}
.lang p:nth-child(3) {
  background-color: blue;
}
.repo-card {
  margin-bottom: 1rem;
}

.img-wrap {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  margin-right: 4px;
  border: 2px solid lightblue;
  overflow: hidden;
  margin-top: 10px;
}
.img-wrap img{
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card-footer{
  display: flex;
  justify-content: space-between;
  align-items: center
}
.child-a {
  display: flex;
  align-items: center;
}
.child-a p {
  font-size: 13px;
  color: #444;
}
.child-b {
  display: flex;
  align-items: center
}
              
            
!

JS

              
                const form = document.querySelector('#form')
const input = document.querySelector('.username')
const submitBtn = document.querySelector('.submit-btn')
const cards = document.querySelector('.cards')
const repoModal = document.querySelector('.modal')
const closeBtn = document.querySelector('.fa-times')

closeBtn.addEventListener('click', () => {
  repoModal.classList.remove('show-modal')
})

window.addEventListener('DOMContentLoaded', () => {
 getUser('lukas')
})

form.addEventListener('submit', (e) => {
  e.preventDefault()
  let name = input.value;
  name.split(' ').join('')

  if (name) {
    getUser(name)
    input.value = ''
  }
})

//get user
const getUser = (arg) => {
    fetch(`https://api.github.com/users/${arg}`).then(res => {
      return res.json()
    }).then(data => {
      if(data.login === undefined) {
        console.log('user not found');
      }
      const id = data.id
      const repo = data.public_repos
      const following = data.following
      const followers = data.followers
      const dateCreated = data.created_at

      let user_id = localStorage.getItem('userID')
      let user_repo = localStorage.getItem('userREPO')

       if(user_id){
         //
         console.log(user_repo);
         console.log('user updated');
       } else {
         // no data in the storage, set it
         localStorage.setItem('userID', id)
         localStorage.setItem('userREPO', repo)
         localStorage.setItem('userFOLLOWING', following)
         localStorage.setItem('userFOLLOWER', followers)
         localStorage.setItem('userDATE',  dateCreated)
         console.log('user created');
       }
      //
      displayProfile(data)
      
      //fetch repos
      return fetch(data.repos_url).then(res => {
        return res.json()
      }).then(data => {
       // console.log(data);
      })
    }).catch(err => {
      console.log(err);
    })
}

//profile
const displayProfile = (user) => {
  let arr = []
  arr.push(user)
  let timeline = arr.map(info => {
    const { public_repos, following, followers, updated_at } = info;
    return `
    
    <!--- repo --->
    <li class="card">
              <span>
                <i class="fas fa-folder fa-3x"></i>
                <h2>Repository</h2>
                <p>${public_repos}</p>
                <button class='btn'>view</button>
              </span>
            </li> 
            
   <!-- following-->
    <li class="card">
              <span>
                <i class="fas fa-user fa-3x"></i>
                <h2>Following</h2>
                <p>${following}</p>
              </span>
            </li> 
            
    <!--follower-->
    <li class="card">
              <span>
                <i class="fas fa-user-alt fa-3x"></i>
                <h2>Followers</h2>
                <p>${followers}</p>
              </span>
            </li> 
            
    <!-- update-->
    <li class="card">
              <span>
                <i class="fas fa-edit fa-3x"></i>
                <h2>Last Update</h2>
                spa${updated_at}</p>
              </span>
            </li>
    `
  })
  timeline = timeline.join('')
  cards.innerHTML = timeline

  const btn = document.querySelector('.btn');
  btn.addEventListener('click', () => {
    // console.log('click');
    repoModal.classList.add('show-modal')
  })
}
              
            
!
999px

Console