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 CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

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.

              $size: 16px

  font-family: sans-serif

  font-size: $size*2
  text-align: center
  font-weight: 700
  padding-top: 20px
  padding-bottom: 20px

  padding: 20px
  text-align: center
  margin-left: auto
  margin-right: auto
td, th 
  padding: 10px
  vertical-align: middle
  font-size: $size
    width: 60px
    height: 60px
  border: 1px solid #999
  color: #333
  @extend .row
  background-color: #999

  @extend .row
  background-color: white
  font-weight: 700
  color: gray
  text-decoration: underline
  cursor: pointer

  font-weight: 400
  color: black
  text-decoration: underline
  cursor: pointer

  width: 2*$size
  margin: 50px 0 50px 0
  font-size: 30px
  text-align: center
              class App extends React.Component {
  render() {
    return <div>
      <h1>FreeCodeCamp Leaderboard</h1>
      <LeaderBoard />
      <p>Code by <a href="http://lukewalker.org" target="_blank">Luke Walker</a></p>

class UserRow extends React.Component {
  render() {
    var rank = this.props.index + 1;
    var rowStyle = rank % 2 === 0 ? 'evenRow' : 'oddRow'
    return <tr className={rowStyle} key={rank}><td>{rank}</td><td><img src={this.props.avatar} /></td><td>{this.props.username}</td><td>{this.props.recent}</td><td>{this.props.alltime}</td></tr>;

class LeaderBoard extends React.Component {
  constructor(props) {
    this.state = { users: [], sort: 'Recent', loading: true } 
    this.recent = this.recent.bind(this)
    this.alltime = this.alltime.bind(this)
  componentDidMount() {
  renderLoading() {
    return <div id="loading">Loading...</div>
  recent() {
    .then(data => this.setState({ users: data, sort: 'Recent', loading: false }))
  alltime() {
    .then(data => this.setState({ users: data, sort: 'All Time', loading: false }))
  render() {
    var leaderList = this.state.users.map((user, idx) => <UserRow index={idx} avatar={user.img} username={user.username} recent={user.recent} alltime={user.alltime} /> )
    return <table>
      <thead><tr><th>Rank</th><th>Avatar</th><th>Username</th><th onClick={this.recent} className={this.state.sort === 'Recent' ? 'selected' : 'unselected'}>Recent</th><th onClick={this.alltime} className={this.state.sort === 'All Time' ? 'selected' : 'unselected'}>All Time</th></tr></thead>
      <tbody>{ this.state.loading? this.renderLoading() : leaderList }</tbody></table>

var recent = "https://fcctop100.herokuapp.com/api/fccusers/top/recent"
var alltime = "https://fcctop100.herokuapp.com/api/fccusers/top/alltime"        
ReactDOM.render(<App />, document.querySelector('#app'))
Loading ..................