Added markdown pages for privacy policy and credits
This commit is contained in:
@@ -5,6 +5,7 @@ import { useCookies } from 'react-cookie';
|
||||
|
||||
//library components
|
||||
import LazyRoute from './lazy-route';
|
||||
import Markdown from './panels/markdown';
|
||||
|
||||
//styling
|
||||
//TODO: styling import
|
||||
@@ -45,6 +46,9 @@ const App = props => {
|
||||
|
||||
<LazyRoute path='/admin' component={() => import('./pages/admin')} />
|
||||
|
||||
<LazyRoute path='/privacypolicy' component={async () => () => <Markdown content={require('../markdown/privacy-policy.md').default} />} />
|
||||
<LazyRoute path='/credits' component={async () => () => <Markdown content={require('../markdown/credits.md').default} />} />
|
||||
|
||||
<LazyRoute path='*' component={() => import('./pages/not-found')} />
|
||||
</Switch>
|
||||
<Footer />
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import React from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
const Footer = () => {
|
||||
return (
|
||||
<footer>
|
||||
<p className='centered'>MERN template designed by Kayne Ruse, KR Game Studios</p>
|
||||
<p className='centered'>MERN template designed by <a href='https://krgamestudios.com'>Kayne Ruse, KR Game Studios</a> - <Link to='/privacypolicy'>Privacy Policy</Link> - <Link to='/credits'>Credits</Link></p>
|
||||
</footer>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import ReactMarkdown from 'react-markdown/with-html';
|
||||
|
||||
const Markdown = props => {
|
||||
//content?
|
||||
let [contentHook, setContentHook] = useState(null);
|
||||
|
||||
//check arguments
|
||||
if (!props.content) {
|
||||
if (!props.uri) {
|
||||
throw 'Markdown requires either content or uri prop';
|
||||
}
|
||||
|
||||
//once
|
||||
useEffect(() => {
|
||||
fetch(props.uri)
|
||||
.then(blob => blob.text())
|
||||
.then(blob => setContentHook(blob))
|
||||
.catch(e => console.error(e))
|
||||
;
|
||||
}, []);
|
||||
} else
|
||||
|
||||
//assume raw info
|
||||
if (!contentHook) {
|
||||
setContentHook(props.content);
|
||||
}
|
||||
|
||||
return (
|
||||
<ReactMarkdown escapeHtml={false} props={{...props}}>{contentHook}</ReactMarkdown>
|
||||
);
|
||||
};
|
||||
|
||||
export default Markdown;
|
||||
@@ -0,0 +1,5 @@
|
||||
# Credits
|
||||
|
||||
MERN Template developed by Kayne Ruse, KR Game Studios
|
||||
|
||||
[https://github.com/krgamestudios/MERN-template](https://github.com/krgamestudios/MERN-template)
|
||||
@@ -0,0 +1,2 @@
|
||||
# Privacy Policy
|
||||
|
||||
Reference in New Issue
Block a user