blob: 543cd4618a1e06378fb576c5c3e4c3dda69a86e8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
import React from 'react';
import NewPaste from './NewPaste'
import ViewPaste from './ViewPaste'
import Footer from './Footer'
import styled from 'styled-components'
import {
BrowserRouter as Router,
Switch,
Route,
Link,
useParams
} from "react-router-dom";
import Raw from './renderers/Raw'
const SpacedTitle = styled.div`
margin-top: 10vh
`
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} />
);
}
const GetRawWithParam = () => {
let { hash } = useParams();
return (
<Raw hash={hash} />
);
}
const App = () => {
return (
<Router>
<Switch>
<Route path="/raw/:hash"
children={<GetRawWithParam />}
/>
<Route>
<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>
</Route>
</Switch>
</Router>
);
}
export default App;
|