Created
April 28, 2019 15:52
-
-
Save FbN/65d5c0c9c9be07bd34758c25fedeb607 to your computer and use it in GitHub Desktop.
Components Declaration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// m: Mithril lib | |
// I: Immutable JS | |
// M: Most Core | |
import { m, I, M } from './vendor.mjs' | |
// Function to generate mithril component with stream integration | |
import { mm } from './mm.mjs' | |
// We import component View e VM | |
import mainView from './view/main.mjs' | |
import mainVM from './vm/main.mjs' | |
import itemView from './view/item.mjs' | |
import itemVM from './vm/item.mjs' | |
import footerView from './view/footer.mjs' | |
import footerVM from './vm/footer.mjs' | |
// Componet declarations | |
export const mainComponent = mm( | |
{ // Component initial state | |
isAllCompleted: false, | |
tasks: [], | |
txt: '' | |
}, | |
mainVM, // Component VM | |
mainView // Component View | |
) | |
export const itemComponent = mm( | |
{ | |
item: {}, | |
editing: false, | |
editingText: '' | |
}, | |
itemVM, | |
itemView | |
) | |
export const footerComponent = mm( | |
{ | |
tasks: [], | |
itemLeft: 0 | |
}, | |
footerVM, | |
footerView | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment