Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Grunest committed Aug 18, 2021
1 parent 573cfc5 commit 02a1097
Show file tree
Hide file tree
Showing 17 changed files with 53 additions and 20,999 deletions.
5 changes: 5 additions & 0 deletions .next/build-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
"static/development/_ssgManifest.js"
],
"pages": {
"/": [
"static/chunks/webpack.js",
"static/chunks/main.js",
"static/chunks/pages/index.js"
],
"/_app": [
"static/chunks/webpack.js",
"static/chunks/main.js",
Expand Down
1 change: 1 addition & 0 deletions .next/server/pages-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"/_app": "pages/_app.js",
"/_error": "pages/_error.js",
"/_document": "pages/_document.js",
"/": "pages/index.js",
"/blog": "pages/blog.js"
}
2 changes: 1 addition & 1 deletion .next/static/chunks/webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@
/******/
/******/ /* webpack/runtime/getFullHash */
/******/ !function() {
/******/ __webpack_require__.h = function() { return "f742e2003338ff922586"; }
/******/ __webpack_require__.h = function() { return "fcd24dceb116c7f417f4"; }
/******/ }();
/******/
/******/ /* webpack/runtime/global */
Expand Down
2 changes: 1 addition & 1 deletion .next/static/development/_buildManifest.js

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

File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 16 additions & 0 deletions components/DefaultLayout.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import MyHeader from "./DefaultHeader";
import MyHead from "./DefaultHead";
import Footer from "./DefaultFooter";

export default function Layout({ children, page }) {
return (
<>
<MyHead page={page} />
<div id="Layout">
<MyHeader />
{children}
<Footer />
</div>
</>
);
}
18 changes: 0 additions & 18 deletions components/MyLayout.js

This file was deleted.

3 changes: 1 addition & 2 deletions components/BlogPost.js → pages/blog/components/BlogPost.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import WordBreak from "./WordBreak";
import WordBreak from "../../../components/WordBreak";
import { Component } from "react";
import moment from "moment";

Expand Down Expand Up @@ -29,7 +29,6 @@ class BlogPost extends Component {
}

render() {
console.log(this.props.imgPath);
return (
<div
className="BlogPost"
Expand Down
47 changes: 27 additions & 20 deletions pages/blog.js → pages/blog/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import React, { Component } from "react";
import Layout from "../components/MyLayout";
import BlogPost from "../components/BlogPost";
import Layout from "../../components/DefaultLayout";
import BlogPost from "./components/BlogPost";
import axios from "axios";

class Blog extends Component {
constructor(props) {
super(props);
this.state = {
numBlogs: 0,
blogDataRetrieved: false,
blogData: [],
};
}
Expand All @@ -17,12 +18,15 @@ class Blog extends Component {
method: "GET",
url: "https://rg-portfolio-backend.herokuapp.com/blog-posts",
}).then((res) => {
console.log(res);
this.setState({ blogData: res.data, numBlogs: res.data.length });
this.setState({
blogData: res.data,
numBlogs: res.data.length,
blogDataRetrieved: true,
});
});
} catch (err) {
console.warn("failed to retrieve blog posts:\n", err);
return;
return false;
}
}
render() {
Expand Down Expand Up @@ -54,21 +58,24 @@ class Blog extends Component {
}
}}
<div className="blogpost-container">
{this.state.blogData.reverse().map((blog, index) => {
let blogImg = blog.blogMedia
? `https://rg-portfolio-bucket.s3.us-west-2.amazonaws.com/blog-images/${blog.blogMedia.name}`
: "";
return (
<BlogPost
id={blog.id}
title={blog.blogHeader}
text={blog.blogText}
imgPath={blogImg}
date={blog.createdAt}
key={blog.blogHeader}
/>
);
})}
{this.state.blogDataRetrieved
? this.state.blogData.reverse().map((blog, index) => {
const blogImg = blog.blogMedia
? `https://rg-portfolio-bucket.s3.us-west-2.amazonaws.com/blog-images/${blog.blogMedia.name}`
: "";

return (
<BlogPost
id={blog.id}
title={blog.blogHeader}
text={blog.blogText}
imgPath={blogImg}
date={blog.createdAt}
key={blog.blogHeader}
/>
);
})
: "beans"}
</div>
</Layout>
</div>
Expand Down
2 changes: 1 addition & 1 deletion pages/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Layout from "../components/MyLayout";
import Layout from "../components/DefaultLayout";
import Who from "../components/index/Who";
import Art from "../components/index/Art";

Expand Down
45 changes: 0 additions & 45 deletions pages/p/[id].js

This file was deleted.

66 changes: 0 additions & 66 deletions pages/shop.js

This file was deleted.

109 changes: 0 additions & 109 deletions queries/shop.js

This file was deleted.

Empty file removed types/Types.js
Empty file.
Loading

1 comment on commit 02a1097

@vercel
Copy link

@vercel vercel bot commented on 02a1097 Aug 18, 2021

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.