mirror of
https://github.com/codeninjasuk/leaderboard.git
synced 2024-11-22 15:27:54 -05:00
Initial Push
This commit is contained in:
parent
a53125b7c2
commit
f335abc8f6
4 changed files with 765 additions and 0 deletions
250
assets/csvkit.js
Normal file
250
assets/csvkit.js
Normal file
|
@ -0,0 +1,250 @@
|
||||||
|
(function() {
|
||||||
|
this.CSVKit = {};
|
||||||
|
|
||||||
|
/* Utils */
|
||||||
|
|
||||||
|
var ctor = function() {};
|
||||||
|
var inherits = function(child, parent){
|
||||||
|
ctor.prototype = parent.prototype;
|
||||||
|
child.prototype = new ctor();
|
||||||
|
child.prototype.constructor = child;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* CSVKit.Reader */
|
||||||
|
|
||||||
|
CSVKit.Reader = function(options) {
|
||||||
|
options = options || {};
|
||||||
|
|
||||||
|
this.separator = options.separator || ',';
|
||||||
|
this.quote_char = options.quote_char || '"';
|
||||||
|
this.escape_char = options.escape_char || '"';
|
||||||
|
this.column_names = options.column_names || [];
|
||||||
|
this.columns_from_header = 'columns_from_header' in options ? options.columns_from_header : true;
|
||||||
|
this.nested_quotes = 'nested_quotes' in options ? options.nested_quotes : false;
|
||||||
|
this.rows = [];
|
||||||
|
|
||||||
|
this.state = {
|
||||||
|
rows: 0,
|
||||||
|
open_record: [],
|
||||||
|
open_field: '',
|
||||||
|
last_char: '',
|
||||||
|
in_quoted_field: false
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
CSVKit.Reader.prototype.parse = function(data) {
|
||||||
|
if (this.state.open_record.length === 0) {
|
||||||
|
if (data.charCodeAt(0) === 0xFEFF) {
|
||||||
|
data = data.slice(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = 0; i < data.length; i++) {
|
||||||
|
var c = data.charAt(i), next_char;
|
||||||
|
switch (c) {
|
||||||
|
// escape and separator may be the same char, typically '"'
|
||||||
|
case this.escape_char:
|
||||||
|
case this.quote_char:
|
||||||
|
var is_escape = false;
|
||||||
|
|
||||||
|
if (c === this.escape_char) {
|
||||||
|
next_char = data.charAt(i + 1);
|
||||||
|
|
||||||
|
if (this._is_escapable(next_char)) {
|
||||||
|
this._add_character(next_char);
|
||||||
|
i++;
|
||||||
|
is_escape = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!is_escape && (c === this.quote_char)) {
|
||||||
|
if (this.state.open_field && !this.state.in_quoted_field) {
|
||||||
|
this.state.in_quoted_field = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.state.in_quoted_field) {
|
||||||
|
// closing quote should be followed by separator unless the nested quotes option is set
|
||||||
|
next_char = data.charAt(i + 1);
|
||||||
|
|
||||||
|
if (next_char && next_char !== '\r' && next_char != '\n' && next_char !== this.separator && this.nested_quotes !== true) {
|
||||||
|
throw new Error("separator expected after a closing quote; found " + next_char);
|
||||||
|
} else {
|
||||||
|
this.state.in_quoted_field = false;
|
||||||
|
}
|
||||||
|
} else if (this.state.open_field === '') {
|
||||||
|
this.state.in_quoted_field = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case this.separator:
|
||||||
|
if (this.state.in_quoted_field) {
|
||||||
|
this._add_character(c);
|
||||||
|
} else {
|
||||||
|
this._add_field();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case '\n':
|
||||||
|
// handle CRLF sequence
|
||||||
|
if (!this.state.in_quoted_field && (this.state.last_char === '\r')) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case '\r':
|
||||||
|
if (this.state.in_quoted_field) {
|
||||||
|
this._add_character(c);
|
||||||
|
} else {
|
||||||
|
this._add_field();
|
||||||
|
this._add_record();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
this._add_character(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.state.last_char = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.state.in_quoted_field) {
|
||||||
|
throw new Error("Input stream ended but closing quotes expected");
|
||||||
|
} else {
|
||||||
|
if (this.state.open_field) {
|
||||||
|
this._add_field();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.state.open_record.length > 0) {
|
||||||
|
this._add_record();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
CSVKit.Reader.prototype._is_escapable = function(c) {
|
||||||
|
if ((c === this.escape_char) || (c === this.quote_char)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
CSVKit.Reader.prototype._add_character = function(c) {
|
||||||
|
this.state.open_field += c;
|
||||||
|
};
|
||||||
|
|
||||||
|
CSVKit.Reader.prototype._add_field = function() {
|
||||||
|
this.state.open_record.push(this.state.open_field);
|
||||||
|
this.state.open_field = '';
|
||||||
|
this.state.in_quoted_field = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
CSVKit.Reader.prototype._add_record = function() {
|
||||||
|
if (this.columns_from_header && this.state.rows === 0) {
|
||||||
|
this.column_names = this.state.open_record;
|
||||||
|
} else {
|
||||||
|
this.rows.push(this._serialize_record(this.state.open_record));
|
||||||
|
}
|
||||||
|
|
||||||
|
this.state.rows++;
|
||||||
|
this.state.open_record = [];
|
||||||
|
this.state.open_field = '';
|
||||||
|
this.state.in_quoted_field = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
CSVKit.Reader.prototype._serialize_record = function(record) {
|
||||||
|
return record;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* CSVKit.ObjectReader */
|
||||||
|
|
||||||
|
CSVKit.ObjectReader = function(options) {
|
||||||
|
CSVKit.Reader.call(this, options);
|
||||||
|
};
|
||||||
|
inherits(CSVKit.ObjectReader, CSVKit.Reader);
|
||||||
|
|
||||||
|
CSVKit.ObjectReader.prototype._serialize_record = function(record) {
|
||||||
|
var obj = {};
|
||||||
|
|
||||||
|
for (var i = 0; i < this.column_names.length; i++) {
|
||||||
|
obj[this.column_names[i]] = record[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* CSVKit.Writer */
|
||||||
|
|
||||||
|
CSVKit.Writer = function(options) {
|
||||||
|
options = options || {};
|
||||||
|
|
||||||
|
this.separator = options.separator || ',';
|
||||||
|
this.quote_char = options.quote_char || '"';
|
||||||
|
this.escape_char = options.escape_char || '"';
|
||||||
|
this.quote_all = options.quote_all || false;
|
||||||
|
this.newline = '\n';
|
||||||
|
|
||||||
|
CSVKit.Writer.prototype.write = function(rows) {
|
||||||
|
var formatted_rows = [];
|
||||||
|
|
||||||
|
for (var i = 0; i < rows.length; i++) {
|
||||||
|
formatted_rows.push(this._serialize_row(rows[i]));
|
||||||
|
}
|
||||||
|
|
||||||
|
return formatted_rows.join(this.newline);
|
||||||
|
};
|
||||||
|
|
||||||
|
CSVKit.Writer.prototype._serialize_row = function(row) {
|
||||||
|
var formatted_cells = [];
|
||||||
|
|
||||||
|
for (var i = 0; i < row.length; i++) {
|
||||||
|
formatted_cells.push(this._serialize_cell(row[i]));
|
||||||
|
}
|
||||||
|
|
||||||
|
return formatted_cells.join(this.separator);
|
||||||
|
};
|
||||||
|
|
||||||
|
CSVKit.Writer.prototype._serialize_cell = function(cell) {
|
||||||
|
if (cell.indexOf(this.quote_char) >= 0) {
|
||||||
|
cell = cell.replace(new RegExp(this.quote_char, 'g'), this.escape_char + this.quote_char);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.quote_all || cell.indexOf(this.separator) >= 0 || cell.indexOf(this.newline) >= 0) {
|
||||||
|
return this.quote_char + cell + this.quote_char;
|
||||||
|
}
|
||||||
|
|
||||||
|
return cell;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/* CSVKit.ObjectWriter */
|
||||||
|
|
||||||
|
CSVKit.ObjectWriter = function(options) {
|
||||||
|
CSVKit.Writer.call(this, options);
|
||||||
|
|
||||||
|
if (!('column_names' in options)) {
|
||||||
|
throw "The column_names option is required.";
|
||||||
|
}
|
||||||
|
|
||||||
|
this.column_names = options.column_names;
|
||||||
|
};
|
||||||
|
inherits(CSVKit.ObjectWriter, CSVKit.Writer);
|
||||||
|
|
||||||
|
CSVKit.ObjectWriter.prototype.write = function(rows) {
|
||||||
|
var header = {};
|
||||||
|
|
||||||
|
for (var i = 0; i < this.column_names.length; i++) {
|
||||||
|
header[this.column_names[i]] = this.column_names[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
rows.splice(0, 0, header);
|
||||||
|
|
||||||
|
return CSVKit.Writer.prototype.write.call(this, rows);
|
||||||
|
}
|
||||||
|
|
||||||
|
CSVKit.ObjectWriter.prototype._serialize_row = function(row) {
|
||||||
|
var cells = [];
|
||||||
|
|
||||||
|
for (var i = 0; i < this.column_names.length; i++) {
|
||||||
|
cells.push(row[this.column_names[i]]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return CSVKit.Writer.prototype._serialize_row.call(this, cells);
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(this);
|
94
assets/leaderboard.js
Normal file
94
assets/leaderboard.js
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
// Sourced from ryanparag on CodePen
|
||||||
|
|
||||||
|
console.clear();
|
||||||
|
|
||||||
|
const tableRow = document.querySelectorAll(".list__row");
|
||||||
|
const overlay = document.querySelector(".overlay");
|
||||||
|
const sidebar = document.querySelector(".sidebar");
|
||||||
|
const closeOverlayBtn = document.querySelector(".button--close");
|
||||||
|
|
||||||
|
const sidebarClose = () => {
|
||||||
|
sidebar.classList.remove("is-open");
|
||||||
|
overlay.style.opacity = 0;
|
||||||
|
setTimeout(() => {
|
||||||
|
overlay.classList.remove("is-open");
|
||||||
|
overlay.style.opacity = 1;
|
||||||
|
}, 300);
|
||||||
|
};
|
||||||
|
|
||||||
|
tableRow.forEach(tableRow => {
|
||||||
|
tableRow.addEventListener("click", function () {
|
||||||
|
overlay.style.opacity = 0;
|
||||||
|
overlay.classList.add("is-open");
|
||||||
|
sidebar.classList.add("is-open");
|
||||||
|
setTimeout(() => {
|
||||||
|
overlay.style.opacity = 1;
|
||||||
|
}, 100);
|
||||||
|
|
||||||
|
// Sidebar content
|
||||||
|
const sidebarBody = document.querySelector(".sidebar__body");
|
||||||
|
sidebarBody.innerHTML = '';
|
||||||
|
|
||||||
|
const driverPlace = this.querySelector(".list__cell:nth-of-type(1) .list__value").innerHTML;
|
||||||
|
const driverName = this.querySelector(".list__cell:nth-of-type(2) .list__value").innerHTML;
|
||||||
|
const driverTeam = this.querySelector(".list__cell:nth-of-type(3) .list__value").innerHTML;
|
||||||
|
const driverPoints = this.querySelector(".list__cell:nth-of-type(4) .list__value").innerHTML;
|
||||||
|
const driverImage = this.dataset.image;
|
||||||
|
const driverNationality = this.dataset.nationality;
|
||||||
|
const driverDOB = this.dataset.dob;
|
||||||
|
const driverCountry = this.dataset.country;
|
||||||
|
|
||||||
|
const newDriver = document.createElement('div');
|
||||||
|
newDriver.classList = 'driver';
|
||||||
|
|
||||||
|
const driverContent = document.createElement('div');
|
||||||
|
driverContent.classList = 'driver__content';
|
||||||
|
|
||||||
|
const profile = document.createElement('div');
|
||||||
|
profile.classList = 'driver__image';
|
||||||
|
profile.style.backgroundImage = `url('${driverImage}')`;
|
||||||
|
newDriver.appendChild(profile);
|
||||||
|
|
||||||
|
const driverTitle = document.createElement('div');
|
||||||
|
driverTitle.classList = 'driver__title';
|
||||||
|
driverTitle.innerHTML = driverName;
|
||||||
|
driverContent.appendChild(driverTitle);
|
||||||
|
|
||||||
|
const driverInfo = document.createElement('div');
|
||||||
|
driverInfo.innerHTML = `
|
||||||
|
<table class="driver__table">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td><small>Belt</small></td>
|
||||||
|
<td>${driverTeam}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><small>Level</small></td>
|
||||||
|
<td>${driverPoints}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><small>Activity</small></td>
|
||||||
|
<td><img src="https://www.countryflags.io/${driverCountry}/shiny/24.png">${driverNationality}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><small>Place</small></td>
|
||||||
|
<td>${driverPlace}</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>`;
|
||||||
|
driverContent.appendChild(driverInfo);
|
||||||
|
|
||||||
|
newDriver.appendChild(driverContent);
|
||||||
|
sidebarBody.appendChild(newDriver);
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
closeOverlayBtn.addEventListener("click", function () {
|
||||||
|
sidebarClose();
|
||||||
|
});
|
||||||
|
|
||||||
|
overlay.addEventListener("click", function () {
|
||||||
|
sidebarClose();
|
||||||
|
});
|
261
assets/style.css
Normal file
261
assets/style.css
Normal file
|
@ -0,0 +1,261 @@
|
||||||
|
html {
|
||||||
|
--black: #21252a;
|
||||||
|
--grey-1: #343A40;
|
||||||
|
--grey-2: #495057;
|
||||||
|
--grey-3: #868E96;
|
||||||
|
--grey-4: #ADB5BD;
|
||||||
|
--grey-5: #CED4DA;
|
||||||
|
--grey-6: #DEE2E6;
|
||||||
|
--grey-7: #E9ECEF;
|
||||||
|
--grey-8: #F1F3F5;
|
||||||
|
--grey-9: #F8F9FA;
|
||||||
|
--trans-black: rgba(33, 37, 42, .9);
|
||||||
|
--red: #e10600;
|
||||||
|
--gold: #ffda65;
|
||||||
|
--gold-dark: #a3862c;
|
||||||
|
--bronze: #c99355;
|
||||||
|
--bronze-dark: #80582c;
|
||||||
|
}
|
||||||
|
|
||||||
|
html {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
*, *:before, *:after {
|
||||||
|
box-sizing: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
html, body {
|
||||||
|
width: 99%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: "Inter UI", system-ui;
|
||||||
|
color: var(--black);
|
||||||
|
background: var(--black);
|
||||||
|
}
|
||||||
|
|
||||||
|
.list {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 600px;
|
||||||
|
margin: 3rem auto 3rem;
|
||||||
|
border-radius: 0.4rem;
|
||||||
|
box-shadow: 0px 12px 25px rgba(0, 0, 0, 0.1), 0px 5px 12px rgba(0, 0, 0, 0.07);
|
||||||
|
}
|
||||||
|
@media screen and (max-width: 800px) {
|
||||||
|
.list {
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.list__table {
|
||||||
|
width: 100%;
|
||||||
|
border-spacing: 0;
|
||||||
|
color: var(--grey-3);
|
||||||
|
}
|
||||||
|
.list__header {
|
||||||
|
padding: 2rem 2rem;
|
||||||
|
background: white;
|
||||||
|
border-top-left-radius: 0.4rem;
|
||||||
|
border-top-right-radius: 0.4rem;
|
||||||
|
}
|
||||||
|
.list__header h1, .list__header h5 {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
.list__header h5 {
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
text-transform: uppercase;
|
||||||
|
color: var(--red);
|
||||||
|
}
|
||||||
|
.list__value {
|
||||||
|
display: block;
|
||||||
|
font-size: 17px;
|
||||||
|
}
|
||||||
|
.list__label {
|
||||||
|
font-size: 10px;
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
.list__row {
|
||||||
|
background: var(--grey-7);
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 300ms ease;
|
||||||
|
}
|
||||||
|
.list__row:hover, .list__row:focus {
|
||||||
|
transform: scale(1.05);
|
||||||
|
box-shadow: 0px 15px 28px rgba(0, 0, 0, 0.1), 0px 5px 12px rgba(0, 0, 0, 0.08);
|
||||||
|
transition: all 300ms ease;
|
||||||
|
}
|
||||||
|
.list__row:not(:last-of-type) .list__cell {
|
||||||
|
box-shadow: 0px 2px 0px rgba(0, 0, 0, 0.08);
|
||||||
|
}
|
||||||
|
.list__row:first-of-type {
|
||||||
|
color: var(--gold-dark);
|
||||||
|
background: var(--grey-9);
|
||||||
|
}
|
||||||
|
.list__row:first-of-type .list__cell:first-of-type {
|
||||||
|
background: var(--gold);
|
||||||
|
color: var(--gold-dark);
|
||||||
|
}
|
||||||
|
.list__row:nth-of-type(2) {
|
||||||
|
color: var(--grey-2);
|
||||||
|
background: var(--grey-9);
|
||||||
|
}
|
||||||
|
.list__row:nth-of-type(2) .list__cell:first-of-type {
|
||||||
|
background: var(--grey-4);
|
||||||
|
color: var(--grey-2);
|
||||||
|
}
|
||||||
|
.list__row:nth-of-type(3) {
|
||||||
|
color: var(--bronze-dark);
|
||||||
|
background: var(--grey-9);
|
||||||
|
}
|
||||||
|
.list__row:nth-of-type(3) .list__cell:first-of-type {
|
||||||
|
background: var(--bronze);
|
||||||
|
color: var(--bronze-dark);
|
||||||
|
}
|
||||||
|
.list__cell {
|
||||||
|
padding: 1rem;
|
||||||
|
}
|
||||||
|
.list__cell:first-of-type {
|
||||||
|
text-align: center;
|
||||||
|
padding: 1rem 0.2rem;
|
||||||
|
background: var(--grey-5);
|
||||||
|
}
|
||||||
|
|
||||||
|
.overlay {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
background: var(--trans-black);
|
||||||
|
display: none;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 300ms ease;
|
||||||
|
}
|
||||||
|
.overlay.is-open {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar {
|
||||||
|
position: fixed;
|
||||||
|
background: white;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 500px;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
box-shadow: none;
|
||||||
|
right: -500px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: flex-start;
|
||||||
|
/*@media screen and (max-width: 650px) {
|
||||||
|
flex-direction: column-reverse;
|
||||||
|
justify-content: space-between;
|
||||||
|
}*/
|
||||||
|
transition: all 300ms ease;
|
||||||
|
}
|
||||||
|
.sidebar.is-open {
|
||||||
|
right: 0;
|
||||||
|
transition: all 300ms ease;
|
||||||
|
box-shadow: 0px 0px 100px var(--black);
|
||||||
|
}
|
||||||
|
.sidebar__header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
background: var(--grey-9);
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.sidebar__header, .sidebar__body {
|
||||||
|
padding: 2rem;
|
||||||
|
}
|
||||||
|
.sidebar__title {
|
||||||
|
font-size: 1.5rem;
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--grey-4);
|
||||||
|
}
|
||||||
|
|
||||||
|
.button {
|
||||||
|
font-family: inherit;
|
||||||
|
border: 0;
|
||||||
|
background: transparent;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.button:focus, .button:active {
|
||||||
|
outline: 0;
|
||||||
|
}
|
||||||
|
.button--close {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
height: auto;
|
||||||
|
line-height: 1;
|
||||||
|
color: var(--grey-5);
|
||||||
|
}
|
||||||
|
.button--close:hover {
|
||||||
|
color: var(--grey--4);
|
||||||
|
}
|
||||||
|
|
||||||
|
.driver {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
opacity: 0;
|
||||||
|
position: relative;
|
||||||
|
left: 100px;
|
||||||
|
-webkit-animation: fade 500ms ease 150ms forwards;
|
||||||
|
animation: fade 500ms ease 150ms forwards;
|
||||||
|
}
|
||||||
|
.driver__image {
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-size: 220px;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: top center;
|
||||||
|
border: 3px solid white;
|
||||||
|
box-shadow: 0px 5px 12px rgba(0, 0, 0, 0.12);
|
||||||
|
margin-right: 1.5rem;
|
||||||
|
}
|
||||||
|
.driver__content {
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
.driver__title {
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 1.6rem;
|
||||||
|
margin: 0.5rem 0;
|
||||||
|
}
|
||||||
|
.driver__table {
|
||||||
|
width: 100%;
|
||||||
|
color: var(--grey-2);
|
||||||
|
}
|
||||||
|
.driver__table small {
|
||||||
|
color: var(--grey-4);
|
||||||
|
}
|
||||||
|
.driver__table td {
|
||||||
|
padding: 0.3rem 0.6rem 0.3rem 0;
|
||||||
|
height: 2rem;
|
||||||
|
}
|
||||||
|
.driver__table td img {
|
||||||
|
position: relative;
|
||||||
|
top: 5px;
|
||||||
|
margin-right: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes fade {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes fade {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
}
|
160
index.html
Normal file
160
index.html
Normal file
|
@ -0,0 +1,160 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Document</title>
|
||||||
|
<link rel="stylesheet" href="/assets/style.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="wrapper">
|
||||||
|
<div class="list">
|
||||||
|
<div class="list__header">
|
||||||
|
<h5>Code Ninjas Langley</h5>
|
||||||
|
<h1><b>IMPACT</b> <span style="font-variant-caps:small-caps">leaderboard</span></h1>
|
||||||
|
</div>
|
||||||
|
<div class="list__body">
|
||||||
|
<table class="list__table">
|
||||||
|
<tr class="list__row" data-image="https://www.formula1.com/content/fom-website/en/drivers/lewis-hamilton/_jcr_content/image.img.1920.medium.jpg/1533294345447.jpg" data-nationality="British" data-dob="1985-01-07" data-country="gb">
|
||||||
|
<td class="list__cell"><span class="list__value">1</span></td>
|
||||||
|
<td class="list__cell"><span class="list__value">Lewis Hamilton</span><small class="list__label">Ninja</small></td>
|
||||||
|
<td class="list__cell"><span class="list__value">White</span><small class="list__label">Belt</small></td>
|
||||||
|
<td class="list__cell"><span class="list__value">8</span><small class="list__label">Level</small></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="list__row" data-image="https://www.formula1.com/content/fom-website/en/drivers/sebastian-vettel/_jcr_content/image.img.1920.medium.jpg/1533294389985.jpg" data-nationality="German" data-dob="1987-07-03" data-country="de">
|
||||||
|
<td class="list__cell"><span class="list__value">2</span></td>
|
||||||
|
<td class="list__cell"><span class="list__value">Sebastian Vettel</span><small class="list__label">Driver</small></td>
|
||||||
|
<td class="list__cell"><span class="list__value">Ferrari</span><small class="list__label">Constructor</small></td>
|
||||||
|
<td class="list__cell"><span class="list__value">78</span><small class="list__label">Points</small></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="list__row" data-image="https://www.formula1.com/content/fom-website/en/drivers/valtteri-bottas/_jcr_content/image.img.1920.medium.jpg/1536135115661.jpg" data-nationality="Finnish" data-dob="1989-08-28" data-country="fi">
|
||||||
|
<td class="list__cell"><span class="list__value">3</span></td>
|
||||||
|
<td class="list__cell"><span class="list__value">Valtteri Bottas</span><small class="list__label">Driver</small></td>
|
||||||
|
<td class="list__cell"><span class="list__value">Mercedes</span><small class="list__label">Constructor</small></td>
|
||||||
|
<td class="list__cell"><span class="list__value">58</span><small class="list__label">Points</small></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="list__row" data-image="https://www.formula1.com/content/fom-website/en/drivers/kimi-raikkonen/_jcr_content/image.img.1920.medium.jpg/1544714269466.jpg" data-nationality="Finnish" data-dob="1979-10-17" data-country="fi">
|
||||||
|
<td class="list__cell"><span class="list__value">4</span></td>
|
||||||
|
<td class="list__cell"><span class="list__value">Kimi Räikkönen</span><small class="list__label">Driver</small></td>
|
||||||
|
<td class="list__cell"><span class="list__value">Ferrari</span><small class="list__label">Constructor</small></td>
|
||||||
|
<td class="list__cell"><span class="list__value">48</span><small class="list__label">Points</small></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="list__row" data-image="https://www.formula1.com/content/fom-website/en/drivers/daniel-ricciardo/_jcr_content/image.img.1920.medium.jpg/1544714300924.jpg" data-nationality="Australian" data-dob="1989-07-01" data-country="au">
|
||||||
|
<td class="list__cell"><span class="list__value">5</span></td>
|
||||||
|
<td class="list__cell"><span class="list__value">Daniel Ricciardo</span><small class="list__label">Driver</small></td>
|
||||||
|
<td class="list__cell"><span class="list__value">Red Bull</span><small class="list__label">Constructor</small></td>
|
||||||
|
<td class="list__cell"><span class="list__value">47</span><small class="list__label">Points</small></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="list__row" data-image="https://www.formula1.com/content/fom-website/en/drivers/max-verstappen/_jcr_content/image.img.1920.medium.jpg/1536135200444.jpg" data-nationality="Dutch" data-dob="1997-09-30" data-country="nl">
|
||||||
|
<td class="list__cell"><span class="list__value">6</span></td>
|
||||||
|
<td class="list__cell"><span class="list__value">Max Verstappen</span><small class="list__label">Driver</small></td>
|
||||||
|
<td class="list__cell"><span class="list__value">Red Bull</span><small class="list__label">Constructor</small></td>
|
||||||
|
<td class="list__cell"><span class="list__value">33</span><small class="list__label">Points</small></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="list__row" data-image="https://via.placeholder.com/300" data-nationality="Spanish" data-dob="1981-07-29" data-country="es">
|
||||||
|
<td class="list__cell"><span class="list__value">7</span></td>
|
||||||
|
<td class="list__cell"><span class="list__value">Fernando Alonso</span><small class="list__label">Driver</small></td>
|
||||||
|
<td class="list__cell"><span class="list__value">McLaren</span><small class="list__label">Constructor</small></td>
|
||||||
|
<td class="list__cell"><span class="list__value">32</span><small class="list__label">Points</small></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="list__row" data-image="https://www.formula1.com/content/fom-website/en/drivers/nico-hulkenberg/_jcr_content/image.img.1920.medium.jpg/1536135087181.jpg" data-nationality="German" data-dob="1987-08-19" data-country="de">
|
||||||
|
<td class="list__cell"><span class="list__value">8</span></td>
|
||||||
|
<td class="list__cell"><span class="list__value">Nico Hülkenberg</span><small class="list__label">Driver</small></td>
|
||||||
|
<td class="list__cell"><span class="list__value">Renault</span><small class="list__label">Constructor</small></td>
|
||||||
|
<td class="list__cell"><span class="list__value">22</span><small class="list__label">Points</small></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="list__row" data-image="https://www.formula1.com/content/fom-website/en/drivers/kevin-magnussen/_jcr_content/image.img.1920.medium.jpg/1536135077427.jpg" data-nationality="Danish" data-dob="1992-10-05" data-country="dk">
|
||||||
|
<td class="list__cell"><span class="list__value">9</span></td>
|
||||||
|
<td class="list__cell"><span class="list__value">Kevin Magnussen</span><small class="list__label">Driver</small></td>
|
||||||
|
<td class="list__cell"><span class="list__value">Haas F1 Team</span><small class="list__label">Constructor</small></td>
|
||||||
|
<td class="list__cell"><span class="list__value">19</span><small class="list__label">Points</small></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="list__row" data-image="https://www.formula1.com/content/fom-website/en/drivers/carlos-sainz/_jcr_content/image.img.1920.medium.jpg/1544796007483.jpg" data-nationality="Spanish" data-dob="1994-09-01" data-country="es">
|
||||||
|
<td class="list__cell"><span class="list__value">10</span></td>
|
||||||
|
<td class="list__cell"><span class="list__value">Carlos Sainz</span><small class="list__label">Driver</small></td>
|
||||||
|
<td class="list__cell"><span class="list__value">Renault</span><small class="list__label">Constructor</small></td>
|
||||||
|
<td class="list__cell"><span class="list__value">19</span><small class="list__label">Points</small></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="list__row" data-image="https://www.formula1.com/content/fom-website/en/drivers/sergio-perez/_jcr_content/image.img.1920.medium.jpg/1536135110814.jpg" data-nationality="Mexican" data-dob="1990-01-26" data-country="mx">
|
||||||
|
<td class="list__cell"><span class="list__value">11</span></td>
|
||||||
|
<td class="list__cell"><span class="list__value">Sergio Pérez</span><small class="list__label">Driver</small></td>
|
||||||
|
<td class="list__cell"><span class="list__value">Force India</span><small class="list__label">Constructor</small></td>
|
||||||
|
<td class="list__cell"><span class="list__value">17</span><small class="list__label">Points</small></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="list__row" data-image="https://www.formula1.com/content/fom-website/en/drivers/pierre-gasly/_jcr_content/image.img.1920.medium.jpg/1544714186959.jpg" data-nationality="French" data-dob="1987-07-03" data-country="fr">
|
||||||
|
<td class="list__cell"><span class="list__value">12</span></td>
|
||||||
|
<td class="list__cell"><span class="list__value">Pierre Gasly</span><small class="list__label">Driver</small></td>
|
||||||
|
<td class="list__cell"><span class="list__value">Toro Rosso</span><small class="list__label">Constructor</small></td>
|
||||||
|
<td class="list__cell"><span class="list__value">12</span><small class="list__label">Points</small></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="list__row" data-image="https://www.formula1.com/content/fom-website/en/drivers/charles-leclerc/_jcr_content/image.img.1920.medium.jpg/1544714150783.jpg" data-nationality="Monegasque" data-dob="1997-10-16" data-country="mc">
|
||||||
|
<td class="list__cell"><span class="list__value">13</span></td>
|
||||||
|
<td class="list__cell"><span class="list__value">Charles Leclerc</span><small class="list__label">Driver</small></td>
|
||||||
|
<td class="list__cell"><span class="list__value">Sauber</span><small class="list__label">Constructor</small></td>
|
||||||
|
<td class="list__cell"><span class="list__value">9</span><small class="list__label">Points</small></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="list__row" data-image="https://via.placeholder.com/300" data-nationality="Belgian" data-dob="1992-03-26" data-country="be">
|
||||||
|
<td class="list__cell"><span class="list__value">14</span></td>
|
||||||
|
<td class="list__cell"><span class="list__value">Stoffel Vandoorne</span><small class="list__label">Driver</small></td>
|
||||||
|
<td class="list__cell"><span class="list__value">McLaren</span><small class="list__label">Constructor</small></td>
|
||||||
|
<td class="list__cell"><span class="list__value">8</span><small class="list__label">Points</small></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="list__row" data-image="https://www.formula1.com/content/fom-website/en/drivers/lance-stroll/_jcr_content/image.img.1920.medium.jpg/1544714229187.jpg" data-nationality="Canadian" data-dob="1998-10-29" data-country="ca">
|
||||||
|
<td class="list__cell"><span class="list__value">15</span></td>
|
||||||
|
<td class="list__cell"><span class="list__value">Lance Stroll</span><small class="list__label">Driver</small></td>
|
||||||
|
<td class="list__cell"><span class="list__value">Williams</span><small class="list__label">Constructor</small></td>
|
||||||
|
<td class="list__cell"><span class="list__value">4</span><small class="list__label">Points</small></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="list__row" data-image="https://via.placeholder.com/300" data-nationality="Swedish" data-dob="1990-09-02" data-country="se">
|
||||||
|
<td class="list__cell"><span class="list__value">16</span></td>
|
||||||
|
<td class="list__cell"><span class="list__value">Marcus Ericsson</span><small class="list__label">Driver</small></td>
|
||||||
|
<td class="list__cell"><span class="list__value">Sauber</span><small class="list__label">Constructor</small></td>
|
||||||
|
<td class="list__cell"><span class="list__value">2</span><small class="list__label">Points</small></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="list__row" data-image="https://via.placeholder.com/300" data-nationality="French" data-dob="1996-09-17" data-country="fr">
|
||||||
|
<td class="list__cell"><span class="list__value">17</span></td>
|
||||||
|
<td class="list__cell"><span class="list__value">Esteban Ocon</span><small class="list__label">Driver</small></td>
|
||||||
|
<td class="list__cell"><span class="list__value">Force India</span><small class="list__label">Constructor</small></td>
|
||||||
|
<td class="list__cell"><span class="list__value">1</span><small class="list__label">Points</small></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="list__row" data-image="https://via.placeholder.com/300" data-nationality="New Zealander" data-dob="1989-11-10" data-country="nz">
|
||||||
|
<td class="list__cell"><span class="list__value">18</span></td>
|
||||||
|
<td class="list__cell"><span class="list__value">Brendon Hartley</span><small class="list__label">Driver</small></td>
|
||||||
|
<td class="list__cell"><span class="list__value">Toro Rosso</span><small class="list__label">Constructor</small></td>
|
||||||
|
<td class="list__cell"><span class="list__value">1</span><small class="list__label">Points</small></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="list__row" data-image="https://www.formula1.com/content/fom-website/en/drivers/romain-grosjean/_jcr_content/image.img.1920.medium.jpg/1536135092872.jpg" data-nationality="French" data-dob="1986-04-17" data-country="fr">
|
||||||
|
<td class="list__cell"><span class="list__value">19</span></td>
|
||||||
|
<td class="list__cell"><span class="list__value">Romain Grosjean</span><small class="list__label">Driver</small></td>
|
||||||
|
<td class="list__cell"><span class="list__value">Haas F1 Team</span><small class="list__label">Constructor</small></td>
|
||||||
|
<td class="list__cell"><span class="list__value">0</span><small class="list__label">Points</small></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="list__row" data-image="https://via.placeholder.com/300" data-nationality="Russian" data-dob="1995-08-27" data-country="ru">
|
||||||
|
<td class="list__cell"><span class="list__value">20</span></td>
|
||||||
|
<td class="list__cell"><span class="list__value">Sergey Sirotkin</span><small class="list__label">Driver</small></td>
|
||||||
|
<td class="list__cell"><span class="list__value">Williams</span><small class="list__label">Constructor</small></td>
|
||||||
|
<td class="list__cell"><span class="list__value">0</span><small class="list__label">Points</small></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="overlay"></div>
|
||||||
|
<div class="sidebar">
|
||||||
|
<div class="sidebar__header">
|
||||||
|
<div class="sidebar__title">Ninja Information</div>
|
||||||
|
<button class="button button--close">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
||||||
|
<circle cx="12" cy="12" r="10"></circle>
|
||||||
|
<line x1="15" y1="9" x2="9" y2="15"></line>
|
||||||
|
<line x1="9" y1="9" x2="15" y2="15"></line>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="sidebar__body"></div>
|
||||||
|
</div>
|
||||||
|
<script src="assets/leaderboard.js"></script>
|
||||||
|
<script src="assets/csvkit.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in a new issue