forked from SoftwareBrothers/adminjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
component.tsx
40 lines (33 loc) · 1.18 KB
/
component.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
import React from 'react'
import { BrowserRouter } from 'react-router-dom'
import { createStore } from 'redux'
import { Provider } from 'react-redux'
import { ThemeProvider, StyleSheetManager } from 'styled-components'
import * as theme from '../../admin-bro-design-system/src/theme'
import { Box, PortalUtils } from '../../admin-bro-design-system/src'
const store = createStore(() => ({}), {})
const Component = (props) => {
const { frameContext } = props
PortalUtils.appendElement = (element) => {
frameContext.document.body.appendChild(element)
},
PortalUtils.removeElement = (id: string): void => {
const domElement = frameContext.document.getElementById(id)
domElement?.remove()
}
return (
<Provider store={store}>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:400,700" type="text/css" />
<BrowserRouter>
<StyleSheetManager target={frameContext.document.head}>
<ThemeProvider theme={theme}>
<Box border="default" p='xxl'>
{props.children}
</Box>
</ThemeProvider>
</StyleSheetManager>
</BrowserRouter>
</Provider>
)
}
export default Component