aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/App.js
diff options
context:
space:
mode:
authorJacky Zhao <[email protected]>2021-03-06 17:57:24 -0800
committerGitHub <[email protected]>2021-03-06 17:57:24 -0800
commit5dd02b5c2acd7a4c408ce9ffa1d95e208d20bbc8 (patch)
tree5a09bea364331dd0f41510153924065b815b702e /frontend/src/App.js
parentfix(typo): public api docs endpoint (diff)
parentfix password modal (diff)
downloadctrl-v-5dd02b5c2acd7a4c408ce9ffa1d95e208d20bbc8.tar.xz
ctrl-v-5dd02b5c2acd7a4c408ce9ffa1d95e208d20bbc8.zip
Merge pull request #70 from jackyzha0/visual-overhaul
Diffstat (limited to 'frontend/src/App.js')
-rw-r--r--frontend/src/App.js58
1 files changed, 58 insertions, 0 deletions
diff --git a/frontend/src/App.js b/frontend/src/App.js
new file mode 100644
index 0000000..a8da469
--- /dev/null
+++ b/frontend/src/App.js
@@ -0,0 +1,58 @@
+import React from 'react';
+import NewPaste from './components/NewPaste'
+import ViewPaste from './components/ViewPaste'
+import styled from 'styled-components'
+import {
+ BrowserRouter as Router,
+ Switch,
+ Route,
+ useParams
+} from "react-router-dom";
+import Raw from './components/renderers/Raw'
+import ThemeProvider from './theme/ThemeProvider'
+import GlobalStyle from './theme/GlobalStyle'
+import {Watermark} from "./components/Watermark";
+
+const Main = styled.div`
+ margin-top: 10vh;
+ padding: 0 20vw 30px 20vw;
+`
+
+const GetPasteWithParam = () => {
+ let { hash } = useParams();
+ return <ViewPaste hash = {hash} />;
+}
+
+const GetRawWithParam = () => {
+ let { hash } = useParams();
+ return <Raw hash={hash} />;
+}
+
+const App = () => {
+ return (
+ <ThemeProvider>
+ <GlobalStyle />
+ <Router>
+ <Switch>
+ <Route path="/raw/:hash"><GetRawWithParam /></Route>
+ <Route>
+ <Watermark/>
+ <Main id="appElement">
+ <Switch>
+ <Route path="/:hash">
+ <GetPasteWithParam />
+ </Route>
+ <Route path="/">
+ <NewPaste />
+ </Route>
+ </Switch>
+ </Main>
+ </Route>
+ </Switch>
+ </Router>
+ </ThemeProvider>
+ );
+}
+
+
+export default App;