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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

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.

            
              $green: #659446;
$light-green: #75a456;
$teal: #426D52;
$dark-gold: #585414;
$light-brown: #3D3A1B;
$chocolate: #1D1405;


html {
  background-color: $chocolate;
  color: white;
}

#board {
  margin: auto;
  overflow: hidden;
  max-width: 1000px;
  background-color: $green;
}

#board-title {
  background-color: $teal;
  max-width: 1000px;
  height: 60px;
  margin: auto;
  margin-top: 50px;
  font-family: 'Caesar Dressing', cursive;
  font-weight: bold;
  font-size: 50px;
  text-align: center;
  padding: 20px 0;
}

#board-labels{
  background-color: $dark-gold;
  position: relative;
  max-width: 1000px;
  height: 50px;
  margin: auto;
  font-family: 'Changa', sans-serif;
  button {
    font-family: 'Changa', sans-serif;
    border: none;
    background: none;
    color: white;
    cursor: pointer;
    padding: 0;
    margin: 0;
    font-size: 16px;
    &.btn-active {
      color: yellow;
    }
  }
  .points {
    padding: 10px;
  }
}

.camper-row {
  img {
    height: 50px;
    width: 50px;
  }
  height: 50px;
  position: relative;
  
  &:nth-child(2n) {
    background-color: $light-green;
  }
}

.column {
  text-align: center;
  font-size: 20px;
  display: block;
  float: left;
  height: 50px;
  &.points {
    width: 60px;
    height: 30px;
    padding: 10px;
    position: absolute;
    &.all-time {
      right: 0;
    }
    &.recent {
      right: 80px;
    }

  }
  &.rank {
    width: 50px;
    height: 30px;
    padding: 10px;
  }
  &.username {
    height: 30px;
    padding: 10px;
  }
  &.user {
    height: 30px;
    padding: 10px 0;
  }
}
            
          
!
            
              var BoardLabels = React.createClass({
    render: function(){
        return(
            <div id="board-labels">
                <div className="column rank">Rank</div>
                <div className="column user">Camper</div>
                <div className="column points all-time btn-active">
                    <button className={this.props.active === 'allTime' ? "btn-active" : ""}  
                            onClick={this.props.displayAllTime}>All Time</button>
                </div>
                <div className="column points recent">
                    <button className={this.props.active === 'recent' ? "btn-active" : ""}  
                            onClick={this.props.displayRecent}>Recent</button>
                </div>
            </div>
        )
    }
});

var CamperData = React.createClass({
    render: function(){
        return(
            <div id="board">
                {this.props.items.map(function(item, index) {
                    return <div className="camper-row" key={index}> 
                        <div className="column rank"> {index+1}</div> 
                        <div className="column avatar"><img src={item.img}/></div>
                        <div className="column username">{item.username}</div> 
                        <div className="column points all-time"> {item.alltime}</div> 
                        <div className="column points recent">{item.recent}</div> 
                    </div>
                })}
            </div>
        )
    }
});

//Main competent rendering all components
var LeaderBoard = React.createClass({
    getInitialState: function(){
        return {
            allTime: [],
            recent: [],
            active: 'allTime'
        }
    },
    componentDidMount: function() {
        let component = this;
        axios.get('https://fcctop100.herokuapp.com/api/fccusers/top/alltime').then(function(allTime){
            axios.get('https://fcctop100.herokuapp.com/api/fccusers/top/recent').then(function(recent){
                component.setState({
                    recent: (recent.data),
                    allTime: (allTime.data)
                });
            })
        }).catch(function(err){console.log(err)});
    },
    displayAllTime: function(){
        console.log("display all time points");
        this.setState({active: 'allTime'});
    },
    displayRecent: function(){
        console.log("display recent points");
        this.setState({active: 'recent'});
    },
    render: function(){
        console.log(this.state);
        return(
            <div>
                <div id="board-title"> FCC Camper Leaderboard </div>
                <BoardLabels displayAllTime={this.displayAllTime} 
                             displayRecent={this.displayRecent} 
                             active={this.state.active} />
                <CamperData items={this.state[this.state.active]}/>
            </div>
        )
    }
});


//render components
ReactDOM.render(<LeaderBoard/>, document.getElementById("app"));
            
          
!
999px
Loading ..................

Console