Skip to content

Commit c22b284

Browse files
committed
website: update markdown preview.
1 parent 6433026 commit c22b284

File tree

3 files changed

+41
-74
lines changed

3 files changed

+41
-74
lines changed

www/package.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,12 @@
88
"map": "source-map-explorer build/static/js/*.js --html build/website-result.html"
99
},
1010
"dependencies": {
11-
"@uiw/react-back-to-top": "1.2.3",
12-
"@uiw/react-color-colorful": "^1.3.1",
13-
"@uiw/react-github-corners": "^1.5.15",
11+
"@uiw/react-markdown-preview-example": "^1.3.1",
1412
"@uiw/react-json-view": "^1.6.0",
15-
"@uiw/react-markdown-preview": "^4.1.0",
1613
"@uiw/react-xml-reader": "1.0.1",
17-
"@wcj/dark-mode": "^1.0.13",
1814
"goober": "^2.1.13",
1915
"react": "^18.2.0",
20-
"react-code-preview-layout": "^3.0.1",
21-
"react-dom": "^18.2.0",
22-
"styled-components": "^6.0.0"
16+
"react-dom": "^18.2.0"
2317
},
2418
"devDependencies": {
2519
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",

www/src/App.tsx

Lines changed: 20 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,8 @@
1-
import GitHubCorners from '@uiw/react-github-corners';
1+
import { CSSProperties, useState } from 'react';
22
import XMLReader from '@uiw/react-xml-reader';
33
import JsonView from '@uiw/react-json-view';
44
import { lightTheme } from '@uiw/react-json-view/light';
5-
import BackToUp from '@uiw/react-back-to-top';
65
import { styled } from "goober";
7-
import { CSSProperties, useState } from 'react';
8-
import MarkdownPreview from './Markdown';
9-
10-
const Header = styled('header')`
11-
padding: 2rem 0;
12-
text-align: center;
13-
h1 {
14-
font-weight: 900;
15-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif,
16-
'Apple Color Emoji', 'Segoe UI Emoji';
17-
}
18-
`;
19-
20-
const SupVersion = styled('sup')`
21-
font-weight: 200;
22-
font-size: 0.78rem;
23-
margin-left: 0.5em;
24-
margin-top: -0.3em;
25-
position: absolute;
26-
`;
27-
28-
const Wrappper = styled('div')`
29-
padding-bottom: 5rem;
30-
`;
316

327
const Examples = styled('div')`
338
text-align: left;
@@ -37,34 +12,24 @@ const Examples = styled('div')`
3712
export default function App() {
3813
const [value, setValue] = useState<any>();
3914
return (
40-
<Wrappper>
41-
<GitHubCorners fixed target="__blank" zIndex={10} href="https://github.com/uiwjs/react-xml-reader" />
42-
<Header>
43-
<h1>
44-
XML Reader for React<SupVersion>v{VERSION}</SupVersion>
45-
</h1>
46-
<Examples>
47-
<XMLReader
48-
parserOptions={{
49-
}}
50-
onFileLoaded={async (data, iFileInfo, iOriginalFile, text) => {
51-
setValue(data);
52-
const txt = await iOriginalFile?.text()
53-
console.log('data:', data, iFileInfo, iOriginalFile, txt)
54-
}}
55-
/>
56-
{value && (
57-
<JsonView
58-
keyName="data"
59-
value={value}
60-
collapsed={false}
61-
style={lightTheme as CSSProperties}
62-
/>
63-
)}
64-
</Examples>
65-
</Header>
66-
<MarkdownPreview />
67-
<BackToUp>Top</BackToUp>
68-
</Wrappper>
15+
<Examples>
16+
<XMLReader
17+
parserOptions={{
18+
}}
19+
onFileLoaded={async (data, iFileInfo, iOriginalFile, text) => {
20+
setValue(data);
21+
const txt = await iOriginalFile?.text()
22+
console.log('data:', data, iFileInfo, iOriginalFile, txt)
23+
}}
24+
/>
25+
{value && (
26+
<JsonView
27+
keyName="data"
28+
value={value}
29+
collapsed={false}
30+
style={lightTheme as CSSProperties}
31+
/>
32+
)}
33+
</Examples>
6934
);
7035
}

www/src/index.tsx

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import React from 'react';
22
import { createRoot } from 'react-dom/client';
3-
import '@wcj/dark-mode';
4-
import App from './App';
53
import { glob, setup } from 'goober';
4+
import MarkdownPreviewExample from '@uiw/react-markdown-preview-example';
5+
import data from '@uiw/react-xml-reader/README.md';
6+
import App from './App';
67

78
setup(React.createElement);
89

@@ -19,16 +20,23 @@ glob`
1920
}
2021
`;
2122

23+
const Github = MarkdownPreviewExample.Github;
24+
const Example = MarkdownPreviewExample.Example;
25+
2226
const container = document.getElementById('root');
2327
const root = createRoot(container!);
2428
root.render(
25-
<React.Fragment>
26-
<dark-mode
27-
permanent
28-
dark="Dark"
29-
light="Light"
30-
style={{ position: 'fixed', top: 8, left: 12, zIndex: 99, fontSize: 32 }}
31-
/>
32-
<App />
33-
</React.Fragment>,
29+
<MarkdownPreviewExample
30+
source={data.source}
31+
components={data.components}
32+
data={data.data}
33+
title="XML View for React"
34+
description="React component that handles xml file input and its parsing."
35+
version={`v${VERSION}`}
36+
>
37+
<Github href="https://github.com/uiwjs/react-json-view" />
38+
<Example>
39+
<App />
40+
</Example>
41+
</MarkdownPreviewExample>
3442
);

0 commit comments

Comments
 (0)