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; flex-direction: column;
align-items: center; align-items: center;
width: 120px; width: 120px;
background: #fff;
} }
.slidebar-logo { .slidebar-logo {

View File

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

View File

@ -3,6 +3,7 @@
// styles initial // styles initial
html { html {
box-sizing: border-box; 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: #d8dee2;
$color-gray-dark: #b7c5d6; $color-gray-dark: #b7c5d6;
$color-gray-darken: #909399; $color-gray-darken: #909399;
$color-white: #fff;
$color-green: #67c23a; $color-green: #67c23a;
$color-orange: #e6a23c; $color-orange: #e6a23c;
$color-red: #f56c6c; $color-red: #f56c6c;