created Note component; filled App with sample state

readme
brian 4 years ago
parent 9a65b90a1b
commit 5552015edc

@ -3,12 +3,23 @@ import Note from './Note.js';
function App(){ function App(){
return { return {
view: function(vnode){ view: function(vnode){
const {bin} = vnode.attrs; // const {bin, notes} = vnode.attrs;
const bin = {id: 'egf35'};
const notes = [
{id: 'aaa', text: 'Note one'},
{id: 'bbb', text: 'Note two'},
{id: 'ccc', text: 'Note three'},
{id: 'ddd', text: 'Note four'},
{id: 'eee', text: 'Note five'},
{id: 'fff', text: 'Note six'},
{id: 'ggg', text: 'Note seven'},
{id: 'hhh', text: 'Note eight'}
];
return m('.app', [ return m('.app', [
m('.top', [ m('.top', [
m('.top-left', [ m('.top-left', [
m('button', {key: 'button'}, 'New Note...'), m('button', {key: 'button'}, 'New Note...'),
m('input.search', {key: 'search'}, {value: ''}), m('input.search', {key: 'search', value: ''}),
m('select.sorting', {key: 'sorting'}, [ m('select.sorting', {key: 'sorting'}, [
m('option', 'Newest -> Oldest'), m('option', 'Newest -> Oldest'),
m('option', 'Oldest -> Newest') m('option', 'Oldest -> Newest')

@ -0,0 +1,13 @@
function Note(){
return {
view: function(vnode){
const {note} = vnode.attrs;
return m('.note', [
m('.text', note.text),
m('button', 'Edit')
]);
}
};
}
export default Note;
Loading…
Cancel
Save