Improve: compatible with ClashX

This commit is contained in:
jas0ncn 2018-09-10 01:24:36 +08:00
parent 546cd9d161
commit f750ec07f1
4 changed files with 9 additions and 6 deletions

View File

@ -5,7 +5,6 @@
flex-direction: column;
align-items: center;
width: 120px;
background: #fff;
}
.slidebar-logo {

View File

@ -1,12 +1,14 @@
import * as React from 'react'
import { render } from 'react-dom'
import { BrowserRouter } from 'react-router-dom'
import { HashRouter, BrowserRouter } from 'react-router-dom'
import { I18nextProvider } from 'react-i18next'
import { AppContainer } from 'react-hot-loader'
import { isClashX } from '@lib/jsBridge'
import App from '@views/App'
import i18n from '@i18n'
const rootEl = document.getElementById('root')
const Router = isClashX() ? HashRouter : BrowserRouter
// Hot Module Replacement API
declare let module: { hot: any }
@ -14,11 +16,11 @@ declare let module: { hot: any }
export default function renderApp () {
render(
<AppContainer>
<BrowserRouter>
<Router>
<I18nextProvider i18n={ i18n }>
<App />
</I18nextProvider>
</BrowserRouter>
</Router>
</AppContainer>,
rootEl
)
@ -28,11 +30,11 @@ export default function renderApp () {
const NewApp = require('./views/App').default
render(
<AppContainer>
<BrowserRouter>
<Router>
<I18nextProvider i18n={ i18n }>
<NewApp />
</I18nextProvider>
</BrowserRouter>
</Router>
</AppContainer>,
rootEl
)

View File

@ -3,6 +3,7 @@
// styles initial
html {
box-sizing: border-box;
background: rgba($color: $color-white, $alpha: 0.9);
}
*,

View File

@ -14,6 +14,7 @@ $color-primary-lightly: #b4ddf5;
$color-gray: #d8dee2;
$color-gray-dark: #b7c5d6;
$color-gray-darken: #909399;
$color-white: #fff;
$color-green: #67c23a;
$color-orange: #e6a23c;
$color-red: #f56c6c;