forked from swagger-api/swagger-editor
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathApp.tsx
157 lines (152 loc) · 4.54 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
import 'bootstrap-italia/dist/css/bootstrap-italia.min.css';
import {
Collapse,
Dropdown,
DropdownMenu,
DropdownToggle,
Header,
HeaderBrand,
HeaderContent,
HeaderRightZone,
HeaderSocialsZone,
HeaderToggler,
Headers,
Icon,
LinkList,
LinkListItem,
Nav,
NavItem,
} from 'design-react-kit';
import { BrowserRouter, Link, Route, Routes } from 'react-router-dom';
import { Home } from './components/home/Home';
import { Standalone } from './components/standalone/Standalone';
import { SchemaViewer } from './components/viewer/SchemaViewer';
const SamplesMenu = () => {
const items = [
{
text: 'Blank Template',
url: '/standalone?url=/schemas/blank-template.oas3.yaml',
},
{
text: 'Tutorial',
url: '/standalone?url=/schemas/tutorial.oas3.yaml',
},
{
text: 'Example Schema',
url: '/standalone?url=/schemas/example-schema.oas3.yaml',
},
{
text: 'Test Schema Base',
url: '/standalone?url=/schemas/test-schema-base.oas3.yaml',
},
{
text: 'Test Schema Object',
url: '/standalone?url=/schemas/test-schema-object.oas3.yaml',
},
{
text: 'Test Schema Expanded',
url: '/standalone?url=/schemas/test-schema-expanded.oas3.yaml',
},
{
text: 'Test Context',
url: '/standalone?url=/schemas/test-context.oas3.yaml',
},
{
text: 'Test Ontoscore',
url: '/standalone?url=/schemas/test-ontoscore.oas3.yaml',
},
{
text: 'Test data.europa.eu/sparql',
url: '/standalone?url=/schemas/europa.oas3.yaml&eu=true',
},
];
return (
<Dropdown>
<DropdownToggle color="primary">Standalone Samples</DropdownToggle>
<DropdownMenu>
<LinkList>
{items.map(({ text, url }, index) => (
<LinkListItem key={index} inDropdown href={url}>
<span>{text}</span>
</LinkListItem>
))}
</LinkList>
</DropdownMenu>
</Dropdown>
);
};
function App() {
return (
<BrowserRouter basename="/">
<Headers>
<Header type="center">
<HeaderContent>
<HeaderBrand iconAlt="it code circle icon" iconName="it-code-circle">
<h2>Schema Editor</h2>
<h3>Italian OpenAPI Schema Editor</h3>
</HeaderBrand>
<HeaderRightZone>
<HeaderSocialsZone label="Info + Repo">
<ul>
<li>
<a
aria-label="Github"
href="https://github.com/italia/schema-editor"
target="_blank"
rel="noreferrer"
>
<Icon icon="it-github" title="Source code" />
</a>
</li>
</ul>
</HeaderSocialsZone>
</HeaderRightZone>
</HeaderContent>
</Header>
<Header type="navbar">
<HeaderContent expand="lg" megamenu>
<HeaderToggler aria-controls="nav1" aria-expanded="false" aria-label="Toggle navigation" onClick={() => {}}>
<Icon icon="it-burger" />
</HeaderToggler>
<Collapse header navbar onOverlayClick={() => {}}>
<div className="menu-wrapper">
<Nav navbar>
<NavItem>
<Link className="nav-link" to="/">
Home
</Link>
</NavItem>
<NavItem>
<Link className="nav-link" to="/standalone?url=/schemas/example-schema.oas3.yaml">
Standalone Schema
</Link>
</NavItem>
<NavItem>
<SamplesMenu />
</NavItem>
<NavItem>
<Link className="nav-link" to="/schema-viewer">
Schema Viewer
</Link>
</NavItem>
<NavItem>
<Link className="nav-link" to="/ace">
ACE editor
</Link>
</NavItem>
</Nav>
</div>
</Collapse>
</HeaderContent>
</Header>
</Headers>
<Routes>
<Route path="/standalone" element={<Standalone />} />
<Route path="/schema-viewer" element={<SchemaViewer />} />
{/* <Route path="/ace" element={<AceTheme />} /> */}
<Route path="/" element={<Home />} />
</Routes>
</BrowserRouter>
);
}
export default App;