cssAudio - ActiveCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatspinnerstartv

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.

              <p>If data does not load, give it a few minutes then reload. I think FreeCodeCamp's API accepts limited calls.</p>
<div id='app'></div>
              table {
  border-collapse: collapse;
  caption {
    font-weight: bold;
    font-size: 125%;
  th {
    padding: 3px;
  td.center {
    text-align: center;
  & th, & td {
    border: 1px solid black;

img {
  width: 8%;
  border-radius: 50%;

  Table body presentational component
const Table = props => {
  const renderCampers = (key, count) =>  {
    const camper = props.campers[key];
      <tr key={key}>
          <a href={`https://www.freecodecamp.com/${camper.username}`} target='_blank'>
            <img src={camper.img} />
        <td className='center'>{camper.recent}</td>
        <td className='center'>{camper.alltime}</td>

  return (
          <th>Camper Name</th>
          <th onClick={(e) => props.handleSort(e, 'recent')}><a href='javascript:void(0)'>Points in the past 30 days</a></th>
          <th onClick={(e) => props.handleSort(e, 'alltime')}><a href='javascript:void(0)'>All time points</a></th>
        {Object.keys(props.campers).map( (key, i) => renderCampers(key, ++i) )}

class CamperLeaderboard extends React.Component {
  state = {
    campers: [],
    sort: 'recent'

  getData = (sort) => {
    let url = `https://fcctop100.herokuapp.com/api/fccusers/top/${sort}`
      .then(response => this.setState({ campers: response.data }))
      .catch(error => console.log(error));

  componentDidMount() {

  handleSort = (e, sort) => {
    this.setState({ sort }, () => this.getData(this.state.sort));

  render() {
    return (
        <p><strong>Click links in table header to sort</strong></p>
        <Table campers={this.state.campers} 
              handleSort={this.handleSort} />

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

To get the top 100 campers for the last 30 days: https://fcctop100.herokuapp.com/api/fccusers/top/recent.
To get the top 100 campers of all time: https://fcctop100.herokuapp.com/api/fccusers/top/alltime.


Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.


Loading ..................