cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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

Looking for quick-add? Try the external resource search, it's quicker and gives you access to the most recent version of thousands of libraries. ☝️

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

Looking for quick-add? Try the external resource search, it's quicker and gives you access to the most recent version of thousands of libraries. ☝️

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.

            
              <body>
  <div id="wrapper" class="wrapper col-lg-10 col-lg-offset-1 col-xs-12">
  </div>
</body>

            
          
!
            
              $primary-text: #ffffff;
$secondary-text: #000000;
$primary-background: #337ab7;
$secondary-background: #ffffff;
$tertiary-background: #333333;

.default-padding {
  padding: 15px;
}
.default-border {
  border-width: 2px;
  border-style: solid;
}

.default-shadow {
	box-shadow: 5px 5px 15px #000000;
}

body {
  background-color: $tertiary-background;
  font-family: "Segoe UI", Frutiger, "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", Arial, sans-serif !important;
	font-size: 14px;
	font-style: normal;
	font-variant: small-caps;
	font-weight: 500;
}
.wrapper {
}

.content-area-wrapper {
  margin-top: 20px;
  color: $secondary-text;
}

.content-area-header {
  @extend .default-shadow;
  background-color: $primary-background;
  color: $primary-text;
  padding: 20px;
}

.content-area-content {
  @extend .default-shadow;
  border-style: solid;
  border-width: 2px 0px 2px 0px;
  border-color: $primary-background * 0.5;
  background-color: $secondary-background;
  margin-left: 5px;
}

.user-headers {
  @extend .default-shadow;
  margin-left: 5px;
  background-color: $secondary-background;
}

.user-element {
  @extend .default-padding;
  background-color: $secondary-background;
  border-style: solid;
  border-width: 0px 0px 2px 0px;
  border-color: $tertiary-background;
  margin: 0px;
  img {
  }
}

.user-position {
  padding-top: 10px;
  font-size: 50px !important;
}

.user-name {
    font-size: 20px;
    margin-top: 28px;
  }

.recent-points { 
  @extend .user-name;
  }

.all-points {
  @extend .user-name;
  }

.content-area-footer{
  @extend .default-shadow;
  @extend .default-padding;
  background-color: $primary-background;
  color: $primary-text;
  margin-bottom: 20px;
}
            
          
!
            
              var topRecent = [];
var topAllTime = [];
getData();

function getData(){
  console.log('getTopRecent');
  $.ajax({
    url: 'https://fcctop100.herokuapp.com/api/fccusers/top/recent',
    type: 'GET',
    success: function(data){
      console.log('success - data length: ' + data.length);
      var i=0;
      while(i<data.length){
        topRecent.push([data[i].username, data[i].img, data[i].recent, data[i].alltime]);
        i++;
      }
      ReactDOM.render(<UserRender />, document.getElementById('user-content-area'));
    },
    error: function(err){
      console.log('error');
    } 
  });
  $.ajax({
    url: 'https://fcctop100.herokuapp.com/api/fccusers/top/alltime',
    type: 'GET',
    success: function(data){
      console.log('success - data length: ' + data.length);
      var i=0;
      while(i<data.length){
        topAllTime.push([data[i].username, data[i].img, data[i].recent, data[i].alltime]);
        i++;
      }
      ReactDOM.render(<UserRender />, document.getElementById('user-content-area'));
    },
    error: function(err){
      console.log('error');
    } 
  });
}

var UserRender = React.createClass({
  render: function(){
    if(this.props.sort === 'all-time'){
            var recentMap = topAllTime.map(function(user, i){
        return(
          <div className='row user-element'>
            <div className='user-position col-lg-2 col-xs-1 text-center'>{i+1}</div>
            <div><img src={user[1]} className='col-lg-1 col-xs-1' alt={user[0]} /></div>
            <div className='user-name text-center col-lg-5 col-xs-4'>{user[0]}</div>
            <div className='recent-points text-center col-lg-2 col-xs-1'>{user[2]}</div>
            <div className='all-points text-center col-lg-2 col-xs-2'>{user[3]}</div>
          </div>
        );
      });
    } else {
      var recentMap = topRecent.map(function(user, i){
        return(
          <div className='row user-element'>
            <div className='user-position col-lg-2 col-sm-1 text-center'>{i+1}</div>
            <div><img src={user[1]} className='col-lg-1 col-sm-1' alt={user[0]} /></div>
            <div className='user-name text-center col-lg-5 col-sm-4'>{user[0]}</div>
            <div className='recent-points text-center col-lg-2 col-sm-1'>{user[2]}</div>
            <div className='all-points text-center col-lg-2 col-sm-2'>{user[3]}</div>
          </div>
        );
     });
    }
    return <div>{recentMap}</div>;
  }
});

var DefaultScreen = React.createClass({
  render:function(){
    return (
    <div>
      <div className='row'>
        <div className='content-area-wrapper col-lg-10 col-lg-offset-1 col-sm-12'>
          <div className='row content-area-header'><h2>Free Code Camp - Camper Leaderboard</h2></div>
          <div className='row user-headers'>
            <div className='col-lg-2 text-center col-sm-2'>&nbsp;#</div>
            <div className='col-lg-5 col-lg-offset-1  col-sm-4 text-center'>Camper</div>
            <div id='past-thirty' className='col-lg-2 text-center'>Past 30 Days</div>
            <div id='all-time' className='col-lg-1 text-center'>All Time</div>
          </div>
          <div id='user-content-area' className='row content-area-content'>      
          </div>
          <div className='row content-area-footer'><span className='pull-right'><a href='http://www.raymondrizzo.com/Portfolio' target='_blank'>Raymond Rizzo</a></span></div>
        </div>
      </div>
    </div>
      )
  }
});


ReactDOM.render(<DefaultScreen />, document.getElementById('wrapper'));

document.getElementById('past-thirty').addEventListener('mouseover', function(){
  $('#past-thirty').toggleClass('btn-primary');
});

document.getElementById('past-thirty').addEventListener('click', function(){
  ReactDOM.render(<UserRender />, document.getElementById('user-content-area'));
});

document.getElementById('past-thirty').addEventListener('mouseout', function(){
  $('#past-thirty').toggleClass('btn-primary');
});

document.getElementById('all-time').addEventListener('mouseover', function(){
  $('#all-time').toggleClass('btn-primary');
});
  
document.getElementById('all-time').addEventListener('mouseout', function(){
  $('#all-time').toggleClass('btn-primary');
});

document.getElementById('all-time').addEventListener('click', function(){
  ReactDOM.render(<UserRender sort='all-time'/>, document.getElementById('user-content-area'));
});


            
          
!
999px
🕑 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 ..................

Console