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.

            
              /* Variables */
$purple: #b4a3ff;
$yellow: #ffda6d;
$green: #74f3a5;
$blue: #e9f2fe;
$shadow: #e0ecfb;
/* Elements */
body {
  background-color: $blue;
  color: #666;
  font-family: 'Lato';
}
h3 {
  text-align: center;
  font-size: 2em;
  margin-top: 2.5em;
  padding-bottom: 0.5em;
  font-family:'Catamaran';
  font-weight: 500;
  span {
    font-size: 0.66em;
    color: $yellow
  }
}
li { 
  list-style:none;
}
ul{
  padding: 0 20px;
}
/* Classes */
.avatar { 
  border-radius: 100%;
}
.avatar-sm { 
  max-height: 32px; 
  float: center;
  margin-right: 2em;
}
.avatar-lg{
  border-style: double;
  border-color: #ddd;
  border-width: 0.25em;
  box-shadow: 0px 2px 4px $blue;
}
.brownies {
  font-size: 0.75em;
  color: #888;
}
.leader{
  display: inline-block;
  vertical-align: text-bottom;
  text-align: center;
  width: 33%;
  z-index: 1;
  position: relative;
  
    .list-index{
      background-color: $green;
      border-radius: 100%;
      width: 1.45em;
      height: 1.45em;
      vertical-align: middle;
      line-height: 1.4em;
      font-size: 0.95em;
      color: white;
      font-weight: 700;
      position: absolute;
      left: 44.5%;
      bottom: 18%;
    }
  
    &:nth-child(1){
      .list-index{
        width: 1.5em;
        height: 1.5em;
        line-height: 1.45em;
        font-size: 1em;
        background-color: $yellow;
      }
    }
    &:nth-child(2){
      float:left;
      padding-top: 2em;
      .list-index{
        background-color: $purple;
      }
    }
  
    &:nth-child(3){
     float:right;
     padding-top: 2em;
    } 
}
.list-index{
  display: inline-block;
}
.list-sm{
  margin: 0 2em;
  padding: 2em 0;
  box-shadow: 0px 1px 1px #e9f2fe;
  * {
    vertical-align: middle;
  }
  .list-index{
    margin: 0;
    padding-right: 2em;
  }
}
.right{
  float:right;
}
.underline{
  text-decoration: underline;
}
.userinfo{
  display: inline-block;
}
.username{
  margin: 0;
  font-size: 0.95em;
  font-weight: 600;
}

#app{
  background-color: #fff;
  box-shadow: 0px 2px 2px 2px $shadow;
  border-radius: 2px;
  max-width: 40em;
  margin: 2.5em auto;
}
#header{
  padding-top: 0.5em;
  padding-right: 1em;
  font-size: 0.95em;
}
#header a {
  color: $purple;
  text-decoration: none;
  font-weight: 700;
}






            
          
!
            
              const recentURL = 'https://fcctop100.herokuapp.com/api/fccusers/top/recent'
const alltimeURL = 'https://fcctop100.herokuapp.com/api/fccusers/top/alltime'


const ListItem = ({index, img, name, isRecent, recent, alltime}) => (
  <li key={name} className={index>3?'list-sm':'leader'}>
    <p className="list-index">{index}</p>
    <img src={img} className={index>3?'avatar avatar-sm':'avatar avatar-lg'}/>
    <div className="userinfo">
    <p className="username">{name}</p>
    <span className="brownies">
    {isRecent ? recent + " recent": alltime + " all-time"} / {' '}
    {isRecent ? alltime + " all-time" : recent + " recent"} 
    </span>
    </div>
  </li>
) 

class Header extends React.Component{
  render(){
    return (
		<div id="header">
        <div className="right">
    		<span>sort: </span>
          <span id="sort">
            <a href="#" onClick={this.props.sortRecent}>
              <span className={this.props.recent ? 'underline' : ''}>recent</span>
            </a> /{' '}
            <a href='#' onClick={this.props.sortAll}>
              <span className={this.props.recent ? '':'underline'}>all time</span>
            </a>
          </span>
        </div>
        <h3>
          <span>✧・゚: *✧・゚:* &nbsp;</span> 
          Brownie Points
        <span>&nbsp;✧・゚: *✧・゚:*</span> 
        </h3>
  		</div>
    )
  }
}

class UserList extends React.Component{
  constructor(props){
    super(props)
    this.state = {
      isRecent: true, 
      dataRecent: [], 
      dataAll: []
    }
    fetch(recentURL)
      .then(response => response.json())
      .then(data => this.setState({dataRecent: data}))
    
    fetch(alltimeURL)
      .then(response => response.json())
      .then(data => this.setState({dataAll: data}))
    
    this.sortRecent = this.sortRecent.bind(this)
    this.sortAll = this.sortAll.bind(this)
    this.getImg = this.getImg.bind(this)
  }
  sortRecent(){
    this.setState({isRecent: true})
  }
  sortAll(){
    this.setState({isRecent: false})
  }
  getImg(url, i){
    return i === 0 ? url + "&s=96" 
    : i === 1 || i === 2 ? url + "&s=64"
    : url + "&s=32"
  }
	render(){
    const dataArr = this.state.isRecent ? this.state.dataRecent : this.state.dataAll
      return (
        <div>
        <Header 
          recent={this.state.isRecent}
          sortRecent={this.sortRecent}
          sortAll={this.sortAll} />
      	<ul id="user-list">
        	{dataArr.map((user, index) => (
            <ListItem 
              index={index + 1}
              img={this.getImg(user.img, index)}
              name={user.username} 
              isRecent={this.state.isRecent} 
              recent={user.recent} 
              alltime={user.alltime} />
          ))}
        </ul>
        </div>
      )
    }
  }

class App extends React.Component{
  render(){
    return(
      <div>
    	  <UserList />
      </div>
    )
  }
}

 ReactDOM.render(<App />, document.getElementById('app'))

            
          
!
999px
Loading ..................

Console