Creacion de contexto base
This commit is contained in:
@@ -6,6 +6,8 @@ import './styles/reset.css';
|
||||
import './styles/main.scss';
|
||||
import './styles/tabs.scss';
|
||||
|
||||
import {StateProvider} from "./services/State";
|
||||
|
||||
import {Nav} from "./components/Nav";
|
||||
import {SearchBar} from "./components/SearchBar";
|
||||
import {ScrollToTopRouter} from "./components/ScrollToTop";
|
||||
@@ -22,22 +24,22 @@ const Main = (props) => {
|
||||
const navigate = (query) => props.history.push(`/search?query=${query}`);
|
||||
|
||||
return (
|
||||
<Grid>
|
||||
<RowCol><h1>Busca la musica que te gusta!</h1></RowCol>
|
||||
<RowCol><SearchBar history={props.history} onQueryChanged={navigate}/></RowCol>
|
||||
<RowCol><Recomended/></RowCol>
|
||||
</Grid>
|
||||
<Grid>
|
||||
<RowCol><h1>Busca la musica que te gusta!</h1></RowCol>
|
||||
<RowCol><SearchBar history={props.history} onQueryChanged={navigate}/></RowCol>
|
||||
<RowCol><Recomended/></RowCol>
|
||||
</Grid>
|
||||
)
|
||||
}
|
||||
|
||||
const NoRoute = (props) => {
|
||||
return (
|
||||
<Grid>
|
||||
<RowCol><h1>Esa pagina no existe</h1></RowCol>
|
||||
<RowCol>
|
||||
<button className='link' onClick={() => props.history.goBack()}>Volver</button>
|
||||
</RowCol>
|
||||
</Grid>
|
||||
<Grid>
|
||||
<RowCol><h1>Esa pagina no existe</h1></RowCol>
|
||||
<RowCol>
|
||||
<button className='link' onClick={() => props.history.goBack()}>Volver</button>
|
||||
</RowCol>
|
||||
</Grid>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -59,7 +61,23 @@ const App = () => (
|
||||
</main>
|
||||
);
|
||||
|
||||
const AppWithState = () => {
|
||||
const initialState = {theme: {primary: 'green'}};
|
||||
|
||||
const reducer = (state, action) => {
|
||||
switch (action.type) {
|
||||
default: return state;
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<StateProvider initialState={initialState} reducer={reducer}>
|
||||
<App/>
|
||||
</StateProvider>
|
||||
);
|
||||
}
|
||||
|
||||
ReactDOM.render(
|
||||
<App/>,
|
||||
<AppWithState/>,
|
||||
document.getElementById('root')
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user