React Leaderboard
How do I make an react leaderboard?
Sortable Leaderboard showing free code campers with the most points. Made using Sass and React for free code camp . What is a react leaderboard? How do you make a react leaderboard? This script and codes were developed by Adam on 28 November 2022, Monday.
React Leaderboard - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>React Leaderboard</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="app"></div> <script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.4.2/react.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.4.2/react-dom.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
React Leaderboard - Script Codes CSS Codes
body { font-family: 'Verdana', sans-serif; background: #222; text-align: center;
}
.container { width: 80%; margin: 0 auto;
}
h1 { font-size: 3em; font-weight: 700; padding: 0.5em; color: #0ec3f9;
}
table { width: 100%;
}
th { padding: 1em; background: #0ec3f9; color: #222; font-size: 1.5em; font-weight: 700;
}
.sortable { cursor: pointer; transition: ease-out 0.2s;
}
.sortable:hover { background: #fff;
}
tbody { color: #fff; background: #333; font-size: 1.2em;
}
tbody:hover { background: #000; transition: ease-out 0.2s;
}
tbody:nth-of-type(even) { background: #444;
}
tbody:nth-of-type(even):hover { background: #000; transition: ease-out 0.2s;
}
td { vertical-align: middle;
}
img { width: 4em; height: 4em; margin: 0.5em; border-radius: 50%; border: 0.25em solid #0ec3f9;
}
React Leaderboard - Script Codes JS Codes
"use strict";
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var App = function (_React$Component) { _inherits(App, _React$Component); function App(props) { _classCallCheck(this, App); var _this = _possibleConstructorReturn(this, _React$Component.call(this, props)); _this.state = { data: [], list: 'recent', ascend: true }; return _this; } App.prototype.componentDidMount = function componentDidMount() { var _this2 = this; fetch("https://fcctop100.herokuapp.com/api/fccusers/top/recent").then(function (response) { return response.json(); }).then(function (json) { return _this2.setState({ data: json }); }); }; App.prototype.sort = function sort(list) { return function () { var _this3 = this; this.setState({ campers: this.state.data.sort(function (a, b) { return _this3.state.ascend ? a[list] - b[list] : b[list] - a[list]; }), list: list, ascend: !this.state.ascend }); }.bind(this); }; App.prototype.render = function render() { return React.createElement( "div", { className: "container" }, React.createElement( "h1", null, "FCC Camper Leaderboard" ), React.createElement( "table", null, React.createElement( "thead", null, React.createElement( "th", null, "Position" ), React.createElement("th", null), React.createElement( "th", null, "Camper" ), React.createElement( "th", { className: "sortable", onClick: this.sort("recent") }, "Recent" ), React.createElement( "th", { className: "sortable", onClick: this.sort("alltime") }, "All Time" ) ), this.state.data.map(function (camper, i) { return React.createElement( "tbody", null, React.createElement( "tr", null, React.createElement( "td", null, i + 1 ), React.createElement( "td", null, React.createElement("img", { src: camper.img }) ), React.createElement( "td", null, camper.username ), React.createElement( "td", null, camper.recent ), React.createElement( "td", null, camper.alltime ) ) ); }) ) ); }; return App;
}(React.Component);
ReactDOM.render(React.createElement(App, null), document.querySelector('.app'));
Developer | Adam |
Username | rzencoder |
Uploaded | November 28, 2022 |
Rating | 3 |
Size | 4,333 Kb |
Views | 10,120 |
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!
Name | Size |
Map Data Across the Globe | 3,900 Kb |
Wikipedia Viewer | 3,276 Kb |
Scatterplot Graph D3 | 5,762 Kb |
HTML Canvas Paint App | 3,477 Kb |
Heat Map Data Visualisation D3 | 5,591 Kb |
Playable Piano Keyboard with Demos | 10,019 Kb |
Scrolling Effects Practice | 6,441 Kb |
Countdown Anagram Game | 7,625 Kb |
Markdown Previewer | 3,929 Kb |
Calculator | 4,572 Kb |
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!
Name | Username | Size |
Base-Style | Daniel_gooss | 2,614 Kb |
Free css icon set v2 - one div | Ben_jammin | 0 Kb |
Countdown Timer | Massiebn | 3,001 Kb |
Drill-down Map | Good886 | 8,484 Kb |
Get third wednesday | Wojtek1150 | 2,691 Kb |
SVG Transform vs CSS Transform | AmeliaBR | 4,175 Kb |
Underlined form fields | Mitchdot | 2,323 Kb |
Single element checkbox | Ivijaygupta | 1,996 Kb |
RWD- Mostly Fluid Layout Pattern | Marcocastro | 2,312 Kb |
A Pen by Brendan Skousen | Bskousen | 2,954 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!