2017-12-31 40 views
-2

여기 내 App.js 파일에 테마가 변경되지 않았습니다. 내가 잘못하고 될 수 무슨 우둔 해요[admin-on-rest] [aor-graqhql]을 사용하는 사용자 정의 테마

import getMuiTheme from 'material-ui/styles/getMuiTheme'; 

import { 
    blue400, blue700, 
    pinkA200, 
    grey100, grey300, grey400, grey500, 
    white, darkBlack, fullBlack, 
} from 'material-ui/styles/colors'; 
import { fade } from 'material-ui/utils/colorManipulator'; 
import spacing from 'material-ui/styles/spacing'; 

const myTheme = { 
    spacing: spacing, 
    fontFamily: 'Roboto, sans-serif', 
    palette: { 
     primary1Color: blue400, 
     primary2Color: blue700, 
     primary3Color: grey400, 
     accent1Color: pinkA200, 
     accent2Color: grey100, 
     accent3Color: grey500, 
     textColor: darkBlack, 
     alternateTextColor: white, 
     canvasColor: white, 
     borderColor: grey300, 
     disabledColor: fade(darkBlack, 0.3), 
     pickerHeaderColor: blue400, 
     clockCircleColor: fade(darkBlack, 0.07), 
     shadowColor: fullBlack, 
    }, 
} 

class App extends Component { 

    constructor() { 
     super(); 
     this.state = { restClient: null }; 
    } 
    componentWillMount() { 
     buildApolloClient() 
      .then(restClient => this.setState({ restClient })); 
    } 

    render() { 
     if (!this.state.restClient) { 
      return <div>Loading</div>; 
     } 

     return (
      <Admin 
       title="Cruceritis HQ" 
       restClient={this.state.restClient} 
       customReducers={{ theme: themeReducer }} 
       theme={getMuiTheme(myTheme)} 
       customSagas={sagas} 
       customRoutes={customRoutes} 
       authClient={authClient} 
       dashboard={Dashboard} 
       loginPage={Login} 
       appLayout={Layout} 
       menu={Menu} 
       messages={translations} 
       locale="es" 

      > 
       <Resource name="Customer" list={VisitorList} edit={VisitorEdit} remove={VisitorDelete} icon={VisitorIcon} /> 
       <Resource name="Command" list={CommandList} edit={CommandEdit} remove={Delete} icon={CommandIcon} options={{ label: 'Orders' }} /> 
       <Resource name="Product" list={ProductList} create={ProductCreate} edit={ProductEdit} remove={Delete} icon={ProductIcon} /> 
       <Resource name="Category" list={CategoryList} edit={CategoryEdit} remove={Delete} icon={CategoryIcon} /> 
       <Resource name="Review" list={ReviewList} edit={ReviewEdit} icon={ReviewIcon} /> 
       <Resource name="Segment" list={SegmentList} icon={SegmentIcon} /> 
       <Resource name="CommandItem" /> 
      </Admin> 
     ); 
    } 
} 

export default App; 

은 ...

나는 무엇을 수정해야

작동하지 않습니다 또한 darkTheme을 가져 오기 시도했습니다?

+0

사용중인 소재 -ui 버전은 무엇입니까? –

+0

그 자체가 aor-graphql을 사용합니다. 그 자체는 lerna 프로젝트입니다. 3 npm 패키지 : admin-on-rest-graphql-demo, aor-pgraphql-client, aor-graphql-client-grahpcool 첫 번째는 on deps로 추가 material-ui "material-ui": "~ 0.19.3", –

답변

0

테마를 적용한 것으로 보이지 않습니다. 당신은 (v0.x에 대한)이 방법을 따라야합니다 : 앞으로

import React from 'react'; 
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'; 
import getMuiTheme from 'material-ui/styles/getMuiTheme'; 
import App from './App'; 

const myTheme = { 
    palette: { 
    primary1Color: 'red', 
    }, 
} 

const Main =() => (
    <MuiThemeProvider muiTheme={getMuiTheme(myTheme)}> 
    <App /> 
    </MuiThemeProvider> 
); 

export default Main; 

는 여전히 문제를 exibits하지만, 적은 소음을 포함하는 간단한 예를 제공 할 수있다.