aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/components/App.js
diff options
context:
space:
mode:
authorjackyzha0 <[email protected]>2020-05-11 21:11:16 -0700
committerjackyzha0 <[email protected]>2020-05-11 21:11:16 -0700
commit433466a3947e75a36b811795bc21be1fff10b5e8 (patch)
tree9e42dad77e7b8bdb3eefbbcfdc3eb7fa90817344 /frontend/src/components/App.js
parentadd basic link + route (diff)
downloadctrl-v-433466a3947e75a36b811795bc21be1fff10b5e8.tar.xz
ctrl-v-433466a3947e75a36b811795bc21be1fff10b5e8.zip
backend redir
Diffstat (limited to 'frontend/src/components/App.js')
-rw-r--r--frontend/src/components/App.js27
1 files changed, 20 insertions, 7 deletions
diff --git a/frontend/src/components/App.js b/frontend/src/components/App.js
index 2f438e9..605903e 100644
--- a/frontend/src/components/App.js
+++ b/frontend/src/components/App.js
@@ -1,28 +1,34 @@
import React from 'react';
-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
+ Link,
+ useParams
} from "react-router-dom";
const SpacedTitle = styled.div`
margin-top: 10vh
`
-const Inline = styled.div`
- display: inline-block
-`
-
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 (
<Router>
@@ -38,7 +44,14 @@ function App() {
</nav>
</SpacedTitle>
- <PasteArea/>
+ <Switch>
+ <Route path="/:hash"
+ children={<GetPasteWithParam />}
+ />
+ <Route path="/">
+ <NewPaste />
+ </Route>
+ </Switch>
<Footer />
</div>