import html from 'choo/html'; import headerImage from '../../dev/images/header.png'; import { homeView } from './home'; import { loginView } from './login'; import { searchView } from './search'; export const viewManager = (state, emit) => { // In viewManager all we are doing is checking the app's state // and passing the state and emit to the relevant view. let htmlContent = html`
loading
`; switch (state.params.page) { case 'home': default: { htmlContent = homeView(state, emit); break; } case 'login': { htmlContent = loginView(state, emit); break; } case 'search': { htmlContent = searchView(state, emit); break; } } // Create a wrapper for view content that includes global header/footer let view = html`
${htmlContent}
`; return view; }