aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/components/App.js
diff options
context:
space:
mode:
authorjackyzha0 <[email protected]>2020-05-15 22:11:13 -0700
committerjackyzha0 <[email protected]>2020-05-15 22:11:13 -0700
commit0b37c8b715b8f5ebea4472c9e7d6104ca8adbdc8 (patch)
treeab7fe8b5f50d2705fc3804562b66bc3dc773ef4b /frontend/src/components/App.js
parentMerge pull request #25 from jackyzha0/security (diff)
downloadctrl-v-0b37c8b715b8f5ebea4472c9e7d6104ca8adbdc8.tar.xz
ctrl-v-0b37c8b715b8f5ebea4472c9e7d6104ca8adbdc8.zip
add view raw button
Diffstat (limited to 'frontend/src/components/App.js')
-rw-r--r--frontend/src/components/App.js63
1 files changed, 39 insertions, 24 deletions
diff --git a/frontend/src/components/App.js b/frontend/src/components/App.js
index 3b147db..ae95dcb 100644
--- a/frontend/src/components/App.js
+++ b/frontend/src/components/App.js
@@ -10,6 +10,7 @@ import {
Link,
useParams
} from "react-router-dom";
+import Raw from './renderers/Raw'
const SpacedTitle = styled.div`
margin-top: 10vh
@@ -29,35 +30,49 @@ const GetPasteWithParam = () => {
);
}
+const GetRawWithParam = () => {
+ let { hash } = useParams();
+
+ return (
+ <Raw hash={hash} />
+ );
+}
+
function App() {
return (
<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>
-
- <main id="appElement">
- <Switch>
- <Route path="/:hash"
- children={<GetPasteWithParam />}
- />
- <Route path="/">
- <NewPaste />
- </Route>
- </Switch>
- </main>
-
- <Footer />
- </div>
+ <Switch>
+ <Route path="/raw/:hash"
+ children={<GetRawWithParam />}
+ />
+ <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>
+
+ <main id="appElement">
+ <Switch>
+ <Route path="/:hash"
+ children={<GetPasteWithParam />}
+ />
+ <Route path="/">
+ <NewPaste />
+ </Route>
+ </Switch>
+ </main>
+
+ <Footer />
+ </div>
+ </Switch>
</Router>
);
}
+
export default App;