aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/components/App.js
diff options
context:
space:
mode:
authorRyan Mehri <[email protected]>2020-05-12 09:29:49 -0600
committerGitHub <[email protected]>2020-05-12 09:29:49 -0600
commitc0fc08d77570232cfda3f6e2bdbac2c3bf1aafeb (patch)
tree9463f3be987993bda22ef4bfc3a56c9174fceee8 /frontend/src/components/App.js
parentMerge pull request #17 from jackyzha0/password (diff)
parentworking no pass rendering (diff)
downloadctrl-v-c0fc08d77570232cfda3f6e2bdbac2c3bf1aafeb.tar.xz
ctrl-v-c0fc08d77570232cfda3f6e2bdbac2c3bf1aafeb.zip
Merge pull request #18 from jackyzha0/no-pass-rendering
no password paste rendering
Diffstat (limited to 'frontend/src/components/App.js')
-rw-r--r--frontend/src/components/App.js60
1 files changed, 53 insertions, 7 deletions
diff --git a/frontend/src/components/App.js b/frontend/src/components/App.js
index 17240f5..605903e 100644
--- a/frontend/src/components/App.js
+++ b/frontend/src/components/App.js
@@ -1,15 +1,61 @@
import React from 'react';
-import Header from './Header'
-import PasteArea from './PasteArea'
+import NewPaste from './NewPaste'
+import ViewPaste from './ViewPaste'
import Footer from './Footer'
+import styled from 'styled-components'
+import {
+ BrowserRouter as Router,
+ Switch,
+ Route,
+ Link,
+ useParams
+} from "react-router-dom";
+
+const SpacedTitle = styled.div`
+ margin-top: 10vh
+`
+
+const Desc = () => {
+ return (
+ <h3>a modern, <a href="https://github.com/jackyzha0/ctrl-v" target="_blank" rel="noopener noreferrer">open-source</a> pastebin with latex and markdown rendering support</h3>
+ );
+}
+
+const GetPasteWithParam = () => {
+ let { hash } = useParams();
+
+ return (
+ <ViewPaste hash = {hash} />
+ );
+}
function App() {
return (
- <div className="lt-content-column">
- <Header />
- <PasteArea />
- <Footer />
- </div>
+ <Router>
+ <div className="lt-content-column">
+ <SpacedTitle>
+ <nav>
+ <h1 className="mainLogo">
+ <span role="img" aria-label="clipboard">📋&nbsp;</span>
+ <Link to="/">ctrl-v</Link>
+ </h1>
+
+ <Desc />
+ </nav>
+ </SpacedTitle>
+
+ <Switch>
+ <Route path="/:hash"
+ children={<GetPasteWithParam />}
+ />
+ <Route path="/">
+ <NewPaste />
+ </Route>
+ </Switch>
+
+ <Footer />
+ </div>
+ </Router>
);
}