Skip to content

Commit

Permalink
Merge pull request #202 from baires/feature/remove-fetch
Browse files Browse the repository at this point in the history
Remove fetch to get friday status
  • Loading branch information
baires authored Mar 4, 2020
2 parents ca27771 + 475cf81 commit 3602a5b
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 45 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ Favicon created by [emilegraphics](https://thenounproject.com/search/?q=dot&i=13


## License
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fbaires%2Fshouldideploy.svg?type=large)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fbaires%2Fshouldideploy?ref=badge_large)
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fbaires%2Fshouldideploy.svg?type=large)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fbaires%2Fshouldideploy?ref=badge_large)
13 changes: 0 additions & 13 deletions component/body_color.js

This file was deleted.

20 changes: 11 additions & 9 deletions component/widget.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState } from "react";
import { getRandom, dayHelper } from "../helpers/constans";
import { getRandom, dayHelper, IS_FRIDAY } from "../helpers/constans";
import Footer from "./footer";

function getData() {
Expand All @@ -14,15 +14,17 @@ function Widget() {
}

return (
<div className="aligner">
<div className="item">
<h3 className="tagline">Should I Deploy Today?</h3>
<h2 id="text">{data}</h2>
<button type="button" id="reload" onClick={onClick}>
Hit me again
</button>
<div className={`wrapper ${IS_FRIDAY && "its-friday"}`}>
<div className="aligner">
<div className="item">
<h3 className="tagline">Should I Deploy Today?</h3>
<h2 id="text">{data}</h2>
<button type="button" id="reload" onClick={onClick}>
Hit me again
</button>
</div>
<Footer />
</div>
<Footer />
</div>
);
}
Expand Down
9 changes: 0 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "shouldideploy",
"description": "Should I Deploy today?",
"author": "Alexis Sagrbossa",
"license": "WTFPL",
"version": "1.0.1",
"repository": "https://github.com/baires/shouldideploy/",
"scripts": {
Expand All @@ -14,7 +15,6 @@
"test": "snyk test"
},
"dependencies": {
"isomorphic-unfetch": "^3.0.0",
"next": "^9.2.2",
"react": "^16.13.0",
"react-dom": "^16.13.0",
Expand Down
11 changes: 2 additions & 9 deletions pages/_document.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,20 @@
import React from "react";
import fetch from "isomorphic-unfetch";
import Document, { Html, Head, Main, NextScript } from "next/document";
import HeadElements from "../component/head";
import { IS_FRIDAY } from "../helpers/constans";

class MyDocument extends Document {
static async getInitialProps(ctx) {
const res = await fetch("https://shouldideploy.today/api");
const json = await res.json();
console.log(json.shouldideploy);
const initialProps = await Document.getInitialProps(ctx);
return { ...initialProps, shouldideploy: json.shouldideploy };
return { ...initialProps };
}

render() {
return (
<Html lang="en">
<Head>
<link rel="icon" type="image/png" href={IS_FRIDAY ? "/dots-red.png" : "/dots.png"} sizes="32x32" />
<meta name="og:image" content={IS_FRIDAY ? "no.png" : "yes.png"} />
<HeadElements />
</Head>
<body className={!this.props.shouldideploy ? "its-friday" : null}>
<body>
<Main />
<NextScript />
</body>
Expand Down
16 changes: 13 additions & 3 deletions pages/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
import React from 'react';
import Widget from '../component/widget';
import React from "react";
import Head from "next/head";
import { IS_FRIDAY } from "../helpers/constans";
import Widget from "../component/widget";

export default () => <Widget />;
export default () => (
<>
<Head>
<link rel="icon" type="image/png" href={IS_FRIDAY ? "/dots-red.png" : "/dots.png"} sizes="32x32" />
<meta name="og:image" content={IS_FRIDAY ? "no.png" : "yes.png"} />
</Head>
<Widget />
</>
);
12 changes: 12 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,18 @@ a:focus {
color: #000;
}

.wrapper {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
height: 100%;
width: 100%;
position: absolute;
top: 0;
left: 0;
}

.aligner {
margin: 4rem;
}
Expand Down

1 comment on commit 3602a5b

@vercel
Copy link

@vercel vercel bot commented on 3602a5b Mar 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.