From da850e6154fd488e18b4654fe8bf46b0a96d85fb Mon Sep 17 00:00:00 2001 From: MichaelCook Date: Fri, 24 Feb 2017 17:03:01 +0000 Subject: [PATCH] He's only gone and bloody done it! --- dist/css/app.css | 2 +- dist/js/app.js | 2 +- src/js/app.js | 36 ++++++++++++++++++++++++++++++------ src/scss/app.scss | 22 ++++++++++++++++++++++ 4 files changed, 54 insertions(+), 8 deletions(-) diff --git a/dist/css/app.css b/dist/css/app.css index 6acc0d7..76be510 100644 --- a/dist/css/app.css +++ b/dist/css/app.css @@ -1 +1 @@ -.container-fluid{max-width:1440px}th{text-transform:capitalize} \ No newline at end of file +.container-fluid{max-width:1440px}h2{font-size:20px}th{text-transform:capitalize;background:#eef7fd}.react-bs-table{border:1px solid #ddd;border-radius:2px;margin:0}.table>tbody>tr>td,.table>tbody>tr>th,.table>tfoot>tr>td,.table>tfoot>tr>th,.table>thead>tr>td,.table>thead>tr>th{padding:1px 6px} \ No newline at end of file diff --git a/dist/js/app.js b/dist/js/app.js index 7b841ed..79b9b74 100644 --- a/dist/js/app.js +++ b/dist/js/app.js @@ -1 +1 @@ -"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var _createClass=function(){function e(e,t){for(var o=0;o { + return cell; +} +const parseTheImdb = (cell, row) => { + // Make it like 7.1 rather than 7.1/10, we all know what it's out of. + if (cell != null) { + return cell.replace('/10', ''); + } +} + class Table extends React.Component { // Runs on init constructor(props) { @@ -25,9 +35,18 @@ class Table extends React.Component { // Create table headers (the rest is all handled by the plugin) headers.map((header, i) => { - let isFirstItem = (i == 0); + let isFirstItem = (i == 0), + parseImdb = (header == 'rating') this.columns.push( - {header} + + {header} + ); }); } @@ -35,7 +54,10 @@ class Table extends React.Component { // Runs on render render() { return ( - + {this.columns} ); @@ -80,7 +102,8 @@ objectifyMarkdownNotWomen.table = function(header, body) { // Ajax the markdown file with all movie data client.open('GET', window.location.href + 'README.md'); client.onreadystatechange = function(e) { - // Wipe movies and collections as this'll run a bunch of times + // Wipe movies, collections and content as this'll run a bunch of times + document.getElementById("root").innerHTML = ''; moviesCollection = []; movies = [{}]; @@ -95,7 +118,7 @@ client.onreadystatechange = function(e) { if (moviesCollection[0] == null) { return; } - //console.log(moviesCollection); + console.log(moviesCollection); //document.body.innerHTML = JSON.stringify(moviesCollection); // Create JSX for tables of each set of movies in moviesCollection @@ -103,7 +126,7 @@ client.onreadystatechange = function(e) { moviesCollection.map((movies, i) => { moviesCollectionJSX.push(
-

{movies.heading}

+

{movies.heading}

) @@ -111,6 +134,7 @@ client.onreadystatechange = function(e) { ReactDOM.render(
+

Movies For Hackers

{moviesCollectionJSX}
, document.getElementById("root") diff --git a/src/scss/app.scss b/src/scss/app.scss index 6aae8ad..2ea7cb7 100644 --- a/src/scss/app.scss +++ b/src/scss/app.scss @@ -1,6 +1,28 @@ .container-fluid { max-width: 1440px; } +h2 { + font-size: 20px; +} th { text-transform: capitalize; + background: #eef7fd; +} +.react-bs-table { + border: 1px solid #ddd; + border-radius: 2px; + margin: 0; +} +.table { + // Cells + > thead, + > tbody, + > tfoot { + > tr { + > th, + > td { + padding: 1px 6px; + } + } + } }