Skip to content

Commit

Permalink
use vanilla js instead of jquery
Browse files Browse the repository at this point in the history
  • Loading branch information
bntzio committed Mar 29, 2017
1 parent 9e0f1c0 commit d537043
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
15 changes: 8 additions & 7 deletions components/ArticlesList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@ import React from 'react';
import { Link } from 'react-router';
import { prefixLink } from 'gatsby-helpers';
import uuid from 'node-uuid';
import $ from 'jquery';

import Article from './Article';

class ArticlesList extends React.Component {
componentWillMount() {
const $body = $('body');
$body.css('color', 'white');
$body.css('background-color', '#4938aa');
const body = document.getElementsByTagName('body');
const css = body[0].style;
css.color = '#fff';
css.backgroundColor = '#4938aa';
}
componentWillUnmount() {
const $body = $('body');
$body.css('color', 'white');
$body.css('background-color', '#2b4496');
const body = document.getElementsByTagName('body');
const css = body[0].style;
css.color = '#fff';
css.backgroundColor = '#2b4496';
}
renderPosts(route) {
const posts = [];
Expand Down
15 changes: 8 additions & 7 deletions components/Post.jsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import React from 'react';
import { Link } from 'react-router';
import { prefixLink } from 'gatsby-helpers';
import $ from 'jquery';

class Post extends React.Component {
componentWillMount() {
const $body = $('body');
$body.css('color', '#333333');
$body.css('background-color', 'white');
const body = document.getElementsByTagName('body');
const css = body[0].style;
css.color = '#333';
css.backgroundColor = '#fff';
}
componentWillUnmount() {
const $body = $('body');
$body.css('color', 'white');
$body.css('background-color', '#2b4496');
const body = document.getElementsByTagName('body');
const css = body[0].style;
css.color = '#fff';
css.backgroundColor = '#2b4496';
}
render() {
const { route } = this.props;
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"front-matter": "^2.1.0",
"gatsby": "^0.12.39",
"history": "^2.1.2",
"jquery": "^3.2.0",
"lodash": "^4.17.2",
"moment": "^2.17.1",
"raw-loader": "^0.5.1",
Expand Down

0 comments on commit d537043

Please sign in to comment.