React Camper Leaderboard

Developer
Size
5,258 Kb
Views
8,096

How do I make an react camper leaderboard?

What is a react camper leaderboard? How do you make a react camper leaderboard? This script and codes were developed by Codoer on 07 December 2022, Wednesday.

React Camper Leaderboard Previews

React Camper Leaderboard - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>React Camper Leaderboard</title> <link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div id='app'></div> <script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.3.1/react.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.3.1/react-dom.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

React Camper Leaderboard - Script Codes CSS Codes

body { background-color: #00aba9; color: #f5f5f5;
}
header { background-color: #006400; margin-bottom: 50px; padding: 7px 15px 7px 15px; height: 50px;
}
header .fcc { width: 250px;
}
header .input-group { margin: 1px 15px 0 0; width: 15%; float: right;
}
footer { background-color: #006400; margin-top: 31px; padding: 6px 15px 6px 15px; height: 50px;
}
footer p { text-align: center; font-size: 30px; margin: 0; color: white;
}
footer p .bill { color: white;
}
.tarea { font-family: arial, sans-serif;
}
.tarea h3 { text-align: center; background-color: #006400; margin: 0; color: white; padding: 10px 0 10px 0;
}
.tarea table:nth-child(even) { background-color: #FFFFFF;
}
.tarea table:nth-child(odd) { background-color: #f9f9f9;
}
.tarea thead { padding: 20px 0 20px 0; font-size: 16px;
}
.tarea thead .alltime, .tarea thead .recent { cursor: pointer; color: green; text-decoration: underline;
}
.tarea thead .num,
.tarea thead .name { color: black;
}
.tarea thead .num,
.tarea thead .alltime,
.tarea thead .recent,
.tarea thead .recent { text-align: center;
}
.tarea tbody { color: black;
}
.tarea tbody .number,
.tarea tbody .rnumber,
.tarea tbody .anumber { text-align: center; vertical-align: middle;
}
.tarea tbody img { width: 40px; border-radius: 4px;
}
.tarea tbody a { padding: 10px;
}

React Camper Leaderboard - Script Codes JS Codes

'use strict';
var recentFlag = false;
var a = [];
var Header = React.createClass({ displayName: 'Header', render: function render() { return React.createElement( 'header', null, React.createElement( 'a', { href: 'https://www.freecodecamp.com', target: '_blank' }, React.createElement('img', { className: 'fcc', src: 'https://s3.amazonaws.com/freecodecamp/freecodecamp_logo.svg', alt: 'freeCodeCamp logo' }) ), React.createElement( 'div', { className: 'input-group' }, React.createElement('input', { className: 'form-control', type: 'text', placeholder: 'Search...', onChange: this.props.change }), React.createElement( 'span', { className: 'input-group-addon' }, React.createElement('i', { className: 'glyphicon glyphicon-search' }) ) ) ); }
});
var Table = React.createClass({ displayName: 'Table', items: function items() { var tableItems = this.props.data.apidata.map(function (val, ind) { var link = 'https://www.freecodecamp.com/' + val.username; return React.createElement( 'tr', null, React.createElement( 'th', { scope: 'row', className: 'number' }, ind + 1 ), React.createElement( 'td', { className: 'username' }, React.createElement('img', { src: val.img, alt: 'img' }), React.createElement( 'a', { href: link, target: '_blank' }, val.username ) ), React.createElement( 'td', { className: 'rnumber' }, val.recent ), React.createElement( 'td', { className: 'anumber' }, val.alltime ) ); }); return tableItems; }, render: function render() { return React.createElement( 'div', { className: 'tarea container' }, React.createElement( 'h3', null, 'Camper Leaderboard' ), React.createElement( 'table', { className: 'table table-striped table-bordered table-hover' }, React.createElement( 'thead', null, React.createElement( 'tr', null, React.createElement( 'th', { className: 'num' }, '#' ), React.createElement( 'th', { className: 'name' }, 'Camper Name' ), React.createElement( 'th', { className: 'recent', onClick: this.props.clickr }, 'Points in past 30 days ', recentFlag ? '▼' : '' ), React.createElement( 'th', { className: 'alltime', onClick: this.props.clicka }, 'All time points ', !recentFlag ? '▼' : '' ) ) ), React.createElement( 'tbody', null, this.items() ) ) ); }
});
var Footer = React.createClass({ displayName: 'Footer', render: function render() { return React.createElement( 'footer', null, React.createElement( 'p', null, 'Coded by ', React.createElement( 'a', { className: 'bill', href: 'https://codepen.io/c0d0er/' }, 'Bill' ) ) ); }
});
var Camper = React.createClass({ displayName: 'Camper', getInitialState: function getInitialState() { return { apidata: [] }; }, getApi: function getApi(api) { a = []; $.getJSON(api, function (data) { data.forEach(function (val) { a.push(val); }); this.setState({ apidata: data }); }.bind(this)); }, handleClickRecent: function handleClickRecent() { recentFlag = true; var reapi = 'https://fcctop100.herokuapp.com/api/fccusers/top/recent'; this.getApi(reapi); }, handleClickAlltime: function handleClickAlltime() { recentFlag = false; var allapi = 'https://fcctop100.herokuapp.com/api/fccusers/top/alltime'; this.getApi(allapi); }, handleChange: function handleChange(e) { var vale = e.target.value; this.setState({ apidata: [] }); var filtered = a.filter(function (val, ind) { return val.username.toLowerCase().includes(vale); }); this.setState({ apidata: filtered }); }, componentDidMount: function componentDidMount() { this.handleClickRecent(); }, render: function render() { return React.createElement( 'div', null, React.createElement(Header, { change: this.handleChange }), React.createElement(Table, { clickr: this.handleClickRecent, clicka: this.handleClickAlltime, data: this.state }), React.createElement(Footer, null) ); }
});
ReactDOM.render(React.createElement(Camper, null), document.getElementById('app'));
React Camper Leaderboard - Script Codes
React Camper Leaderboard - Script Codes
Home Page Home
Developer Codoer
Username c0d0er
Uploaded December 07, 2022
Rating 3
Size 5,258 Kb
Views 8,096
Do you need developer help for React Camper Leaderboard?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Codoer (c0d0er) Script Codes
Create amazing web content with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!