diff options
| author | jackyzha0 <[email protected]> | 2020-05-15 22:11:13 -0700 |
|---|---|---|
| committer | jackyzha0 <[email protected]> | 2020-05-15 22:11:13 -0700 |
| commit | 0b37c8b715b8f5ebea4472c9e7d6104ca8adbdc8 (patch) | |
| tree | ab7fe8b5f50d2705fc3804562b66bc3dc773ef4b /frontend/src/components/App.js | |
| parent | Merge pull request #25 from jackyzha0/security (diff) | |
| download | ctrl-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.js | 63 |
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">📋 </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">📋 </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; |