From c8d17f6af95be40970ab9bc90c2a7cbfc3adc467 Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Thu, 13 Dec 2018 01:18:22 +1100 Subject: [PATCH] Removed duplicated markdown pages, improved NotFound page --- public/index.html | 2 +- src/app.jsx | 13 ++++---- src/pages/landing.jsx | 39 ---------------------- src/pages/{about.jsx => markdown_page.jsx} | 7 ++-- src/pages/not_found.jsx | 7 ++-- src/pages/rules.jsx | 39 ---------------------- src/styles/shared.css | 8 +++++ 7 files changed, 24 insertions(+), 91 deletions(-) delete mode 100644 src/pages/landing.jsx rename src/pages/{about.jsx => markdown_page.jsx} (83%) delete mode 100644 src/pages/rules.jsx diff --git a/public/index.html b/public/index.html index d80491b..6352d87 100644 --- a/public/index.html +++ b/public/index.html @@ -11,6 +11,6 @@
- + \ No newline at end of file diff --git a/src/app.jsx b/src/app.jsx index 86ec2d6..bdca046 100644 --- a/src/app.jsx +++ b/src/app.jsx @@ -6,11 +6,9 @@ import { Header, Container, Divider } from "semantic-ui-react"; import "./styles/shared.css"; //include other pages -import Landing from "./pages/landing.jsx"; -import Rules from "./pages/rules.jsx"; +import MarkdownPage from "./pages/markdown_page.jsx"; import CardList from "./pages/card_list.jsx"; import Concepts from "./pages/concepts.jsx"; -import About from "./pages/about.jsx"; import NotFound from "./pages/not_found.jsx"; //include panels @@ -23,10 +21,11 @@ class App extends React.Component { } render() { + //NOTE: display: flex is set for the container to fix a centering issue in NotFound return (
- +
Mecha: Immense Warfare
Rules @@ -36,11 +35,11 @@ class App extends React.Component {
diff --git a/src/pages/landing.jsx b/src/pages/landing.jsx deleted file mode 100644 index 75b3147..0000000 --- a/src/pages/landing.jsx +++ /dev/null @@ -1,39 +0,0 @@ -import React from "react"; -import ReactMarkdown from "react-markdown"; -import MarkdownRenderers from "../utilities/markdown_renderers.js"; - -class Landing extends React.Component { - constructor(props) { - super(props); - - this.state = { - body: "Loading..." - }; - } - - componentDidMount() { - fetch("/content/landing.md") - .then(result => result.text()) - .then((result) => { - this.setState({ - body: result - }); - }, - //handle errors here instead of a catch block because internet said so - (error) => { - this.setState({ - body: error - }); - }); - } - - render() { - return ( -
- -
- ); - } -} - -export default Landing; \ No newline at end of file diff --git a/src/pages/about.jsx b/src/pages/markdown_page.jsx similarity index 83% rename from src/pages/about.jsx rename to src/pages/markdown_page.jsx index d1ff32e..aef6071 100644 --- a/src/pages/about.jsx +++ b/src/pages/markdown_page.jsx @@ -2,17 +2,18 @@ import React from "react"; import ReactMarkdown from "react-markdown"; import MarkdownRenderers from "../utilities/markdown_renderers.js"; -class About extends React.Component { +class MarkdownPage extends React.Component { constructor(props) { super(props); this.state = { + source: props.source, body: "Loading..." }; } componentDidMount() { - fetch("/content/about.md") + fetch(this.state.source) .then(result => result.text()) .then((result) => { this.setState({ @@ -36,4 +37,4 @@ class About extends React.Component { } } -export default About; \ No newline at end of file +export default MarkdownPage; \ No newline at end of file diff --git a/src/pages/not_found.jsx b/src/pages/not_found.jsx index 654af1a..3c52e96 100644 --- a/src/pages/not_found.jsx +++ b/src/pages/not_found.jsx @@ -1,4 +1,6 @@ import React from "react"; +import { Header } from "semantic-ui-react"; +import LinkButton from "../panels/link_button.jsx"; class NotFound extends React.Component { constructor(props) { @@ -7,8 +9,9 @@ class NotFound extends React.Component { render() { return ( -
-

NotFound

+
+
Page Not Found
+ Return Home
); } diff --git a/src/pages/rules.jsx b/src/pages/rules.jsx deleted file mode 100644 index a96ac7c..0000000 --- a/src/pages/rules.jsx +++ /dev/null @@ -1,39 +0,0 @@ -import React from "react"; -import ReactMarkdown from "react-markdown"; -import MarkdownRenderers from "../utilities/markdown_renderers.js"; - -class Rules extends React.Component { - constructor(props) { - super(props); - - this.state = { - body: "Loading..." - }; - } - - componentDidMount() { - fetch("/content/rules.md") - .then(result => result.text()) - .then((result) => { - this.setState({ - body: result - }); - }, - //handle errors here instead of a catch block because internet said so - (error) => { - this.setState({ - body: error - }); - }); - } - - render() { - return ( -
- -
- ); - } -} - -export default Rules; \ No newline at end of file diff --git a/src/styles/shared.css b/src/styles/shared.css index 747176d..302abe1 100644 --- a/src/styles/shared.css +++ b/src/styles/shared.css @@ -53,6 +53,14 @@ footer { } /* centering */ +.centeredPage { + flex: 1 0 auto; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + .centeredContent { flex: 0 1 auto; display: flex;