-
Notifications
You must be signed in to change notification settings - Fork 8.3k
/
app.tsx
92 lines (85 loc) · 3.15 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
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import React from 'react';
import ReactDOM from 'react-dom';
import { AppMountParameters } from '@kbn/core/public';
import {
EuiPage,
EuiPageBody,
EuiPageContent_Deprecated as EuiPageContent,
EuiText,
EuiHorizontalRule,
EuiPageContentHeader_Deprecated as EuiPageContentHeader,
EuiListGroup,
} from '@elastic/eui';
import { RandomNumberRouteExample } from './random_number_example';
import { RandomNumberBetweenRouteExample } from './random_number_between_example';
import { Services } from './services';
import { PostMessageRouteExample } from './post_message_example';
import { GetMessageRouteExample } from './get_message_example';
type Props = Services;
function RoutingExplorer({
fetchRandomNumber,
fetchRandomNumberBetween,
addSuccessToast,
postMessage,
getMessageById,
}: Props) {
return (
<EuiPage>
<EuiPageBody>
<EuiPageContent>
<EuiPageContentHeader>
<EuiText>
<h1>Routing examples</h1>
</EuiText>
</EuiPageContentHeader>
<EuiText>
<EuiListGroup
listItems={[
{
label: 'IRouter API docs',
href: 'https://github.com/elastic/kibana/blob/main/docs/development/core/server/kibana-plugin-core-server.irouter.md',
iconType: 'logoGithub',
target: '_blank',
size: 's',
},
{
label: 'HttpHandler (core.http.fetch) API docs',
href: 'https://github.com/elastic/kibana/blob/main/docs/development/core/public/kibana-plugin-core-public.httphandler.md',
iconType: 'logoGithub',
target: '_blank',
size: 's',
},
{
label: 'Conventions',
href: 'https://github.com/elastic/kibana/tree/main/STYLEGUIDE.mdx#api-endpoints',
iconType: 'logoGithub',
target: '_blank',
size: 's',
},
]}
/>
</EuiText>
<EuiHorizontalRule />
<RandomNumberRouteExample fetchRandomNumber={fetchRandomNumber} />
<EuiHorizontalRule />
<RandomNumberBetweenRouteExample fetchRandomNumberBetween={fetchRandomNumberBetween} />
<EuiHorizontalRule />
<PostMessageRouteExample addSuccessToast={addSuccessToast} postMessage={postMessage} />
<EuiHorizontalRule />
<GetMessageRouteExample getMessageById={getMessageById} />
</EuiPageContent>
</EuiPageBody>
</EuiPage>
);
}
export const renderApp = (props: Props, element: AppMountParameters['element']) => {
ReactDOM.render(<RoutingExplorer {...props} />, element);
return () => ReactDOM.unmountComponentAtNode(element);
};