aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/App.js
diff options
context:
space:
mode:
authorjackyzha0 <[email protected]>2021-03-05 22:17:18 -0800
committerjackyzha0 <[email protected]>2021-03-05 22:17:18 -0800
commit3e8500d466b641ef34c24f8b0de8163a44ba7a9e (patch)
treeebb3411d636912b12f9fee14ecd494601cd796fc /frontend/src/App.js
parentremove extra langs (diff)
downloadctrl-v-3e8500d466b641ef34c24f8b0de8163a44ba7a9e.tar.xz
ctrl-v-3e8500d466b641ef34c24f8b0de8163a44ba7a9e.zip
refactoring css
Diffstat (limited to 'frontend/src/App.js')
-rw-r--r--frontend/src/App.js60
1 files changed, 60 insertions, 0 deletions
diff --git a/frontend/src/App.js b/frontend/src/App.js
new file mode 100644
index 0000000..99e71ae
--- /dev/null
+++ b/frontend/src/App.js
@@ -0,0 +1,60 @@
+import React from 'react';
+import NewPaste from './components/NewPaste'
+import ViewPaste from './components/ViewPaste'
+import Footer from './components/Footer'
+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>
+ <Footer />
+ </Main>
+ </Route>
+ </Switch>
+ </Router>
+ </ThemeProvider>
+ );
+}
+
+
+export default App;