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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                <h1 class="title is-1 container has-text-centered">Twitch<span>.</span>TV <a href="https://www.twitch.tv" target="_blank"><i class="fa fa-twitch" aria-hidden="true"></i></a></h1>

<div class="searchBox">
<input type="search" class="input" placeholder="Search streamers..." autofocus id="filterInput">
</div>

<main id="output" class="container box">
</main>

<footer class="footer has-text-centered is-paddingless">
  <a href='https://www.linkedin.com/in/simongjetaj' target='_blank'> <span>By Simon</span></a> <i class="fa fa-copyright" aria-hidden="true"></i> 2017
</footer>
              
            
!

CSS

              
                body, html {
  background: linear-gradient(to top, #ffffff, #abbaab);
  background-attachment: fixed;
  background-repeat: no-repeat;
}

.container {
  max-width: 94%;
  margin: auto;
}

div.searchBox {
  max-width: 300px;
  margin: 0 auto;
}

div input[type="search"] {
  max-width: 350px;
  margin-bottom: 4rem;
}

input[type="search"]::placeholder {
  text-align: center;  
}

h1.title, footer {
  font-family: 'Fredoka One', cursive;
}

h1.title {
  margin-top: 1rem;
  letter-spacing: 0.06rem;
}

h1.title.is-1 span{
  color: #6441a5;
  margin-right: -0.67rem;
}

img {
  border-radius: 50%;
}

main#output strong a {
  text-decoration: none;
}

main div.columns strong:hover {
  font-style: italic;
  text-decoration: underline;
}

main#output {
  margin-top: -2.9rem;
}

div.columns {
  display: flex;
  transition: all 0.2s ease;
}

div.columns:hover { 
  transform: scale(1.015);
  background-color: rgba(100, 65, 165, 0.25);
}

.fa-ban {
  color: #FFB300; 
}

.fa-check {
  color: #64DD17;  
}

.fa-twitch {
  color: #6441a5;
  font-size: 2.2rem;
}

footer.footer {
  background-color: rgba(171, 186, 171, 0.02);
}

footer span {
  color: #000;
}

footer span:hover { 
  color: #6441a5;
}

.fa-copyright {
    font-size: 1.2rem;
 }

@media (max-width: 425px) {
  h1.title.is-1 {
    font-size: 2.4rem;
  }
  main p {
    font-size: 0.85em;
  }
  
  input::placeholder {
    font-size: 0.93rem;
  }
  
  img {
    width: 40px;
    height: 40px;
  }
  .fa-twitch {
  font-size: 1.5rem;
  }
  .fa-copyright {
    font-size: 0.9rem;
 }
  footer.footer {
    font-size: 0.9rem;
  }
}
              
            
!

JS

              
                let users = ["simongjetaj", "ESL_SC2", "OgamingSC2", "cretetion", "freecodecamp", "storbeck", "habathcx", "RobotCaleb", "noobs2ninjas"
];
const clientId = "9c1zh48p6w4gvq0tejahra4q2fp934";
let obj = {};
let output = "";

// getting the name and the logo for each user
// adding the necessary properties to the object for each user
users.forEach(user => {
  let streamersApi = `https://api.twitch.tv/kraken/users/${user}?client_id=${clientId}`;
  fetch(streamersApi)
    .then(response => response.json())
    .then(userData => {
      obj.name = userData.display_name;
      obj.logo = userData.logo;

      // is a user streaming or not?
      let isStreaming = `https://api.twitch.tv/kraken/streams/${user}?client_id=${clientId}`;
      fetch(isStreaming)
        .then(response => response.json())
        .then(streamData => {
          obj.name = userData.display_name;
          obj.logo = userData.logo || "https://dummyimage.com/50/fff/000";
          if (streamData.stream === null) {
            obj.online = false;
            obj.status = "";
            obj.text = " is currently offline";
            obj.icon = "fa-ban";
          } else {
            obj.online = true;
            obj.status = streamData.stream.channel.status;
            obj.text = " is currently streaming ";
            obj.icon = "fa-check";
          }

          output += `
                  <div class="columns">
                    <div class="column">
                        <a href="https://www.twitch.tv/${obj.name}" target="_blank">
                          <img width="50" height="50" src="${obj.logo}">
                        </a>
                    </div>
                    <div class="column is-8 has-text-centered">
                      <p>
                        <a class="${obj.online}" href="https://www.twitch.tv/${user}" target="_blank">
                          <strong>${obj.name}</strong>
                        </a>
                        ${obj.text}${obj.status}.
                      </p>
                      </div>
                      <div class="column">
                        <span><i class="fa ${obj.icon} is-pulled-right" aria-hidden="true"></i></span>
                      </div>
                    </div>
                `;
          document.getElementById("output").innerHTML = output;
        })
        .catch(err => console.log(err));
    });
});

// filtering the streamers by their names
let filterInput = document.getElementById("filterInput");
filterInput.addEventListener("keyup", filterUsers);
function filterUsers() {
  filterValue = filterInput.value.toUpperCase();
  let divs = document.querySelectorAll("#output div.columns");

  divs.forEach(a => {
    let names = a.getElementsByTagName("strong")[0];
    // If matched
    if (names.innerHTML.toUpperCase().indexOf(filterValue) != -1) {
      a.style.display = "";
    } else {
      a.style.display = "none";
    }
  });
}

              
            
!
999px

Console