/
App.tsx
59 lines (55 loc) · 2.25 KB
/
App.tsx
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
import { useState } from 'react';
import GitHubCorners from '@uiw/react-github-corners';
import Github from '@uiw/react-shields/esm/github';
import Npm from '@uiw/react-shields/esm/npm';
import BackToUp from '@uiw/react-back-to-top';
import '@wcj/dark-mode';
import logo from './logo.svg';
import './App.css';
import MarkdownPreview from '../';
import MDStr from '../README.md';
let val = 1;
const App = () => {
const [value, setValue] = useState('');
return (
<div className="App">
<BackToUp>Top</BackToUp>
<dark-mode permanent light="Light" dark="Dark"></dark-mode>
<GitHubCorners zIndex={9999} fixed target="__blank" href="https://github.com/uiwjs/react-markdown-preview" />
<header className="App-header">
<img style={{}} src={logo} className="App-logo" alt="logo" />
<a href="https://github.com/uiwjs/react-markdown-preview" target="_blank" rel="noopener noreferrer">
React Markdown Preview
</a>
<p>
React component preview markdown text in web browser. The minimal amount of CSS to replicate the GitHub
Markdown style.
</p>
</header>
<div className="App-editor">
<button onClick={() => setValue('# Markdown ' + val++)}>set value</button>
<textarea
placeholder="Please enter the Markdown code!"
value={value}
spellCheck="false"
onChange={(e) => setValue(e.target.value)}
/>
<MarkdownPreview className="App-editor-preview" source={value} />
</div>
<MarkdownPreview className="App-markdown" source={MDStr.replace(/([\s\S]*)<!--dividing-->/, '')} />
<div className="App-footer">
<Github user="uiwjs" repo="react-markdown-preview">
<Github.Social type="forks" href="https://github.com/uiwjs/react-markdown-preview" />
<Github.Social type="stars" href="https://github.com/uiwjs/react-markdown-preview/stargazers" />
<Github.Social type="watchers" href="https://github.com/uiwjs/react-markdown-preview/watchers" />
</Github>
<Npm.Version
scope="@uiw"
packageName="react-markdown-preview"
href="https://www.npmjs.com/package/@uiw/react-markdown-preview"
/>
</div>
</div>
);
};
export default App;