1- import GitHubCorners from '@uiw/ react-github-corners ' ;
1+ import { CSSProperties , useState } from 'react' ;
22import XMLReader from '@uiw/react-xml-reader' ;
33import JsonView from '@uiw/react-json-view' ;
44import { lightTheme } from '@uiw/react-json-view/light' ;
5- import BackToUp from '@uiw/react-back-to-top' ;
65import { 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
327const Examples = styled ( 'div' ) `
338 text-align: left;
@@ -37,34 +12,24 @@ const Examples = styled('div')`
3712export 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}
0 commit comments