forked from cerebral/overmind
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.tsx
More file actions
33 lines (28 loc) · 748 Bytes
/
index.tsx
File metadata and controls
33 lines (28 loc) · 748 Bytes
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
import * as React from 'react'
import { render } from 'react-dom'
import { injectGlobal } from './styled-components'
import * as iconFont from './icomoon.woff2'
import App from './components/App'
import { viewport } from './utils'
declare global {
interface Window {
rerender: () => void
}
}
injectGlobal`
@font-face {
font-family: 'icomoon';
src: url('${iconFont}') format('woff2');
font-weight: normal;
font-style: normal;
}
`
render(<App />, document.querySelector('#overmind-app'))
window.rerender = () => render(<App />, document.querySelector('#overmind-app'))
window.onresize = () => {
const isMobile = viewport.isMobile
viewport.set()
if (isMobile !== viewport.isMobile) {
window.rerender()
}
}