From 5552015edce2c630400021201734f911cd45c58a Mon Sep 17 00:00:00 2001 From: brian Date: Tue, 9 Mar 2021 23:26:10 -0500 Subject: [PATCH] created Note component; filled App with sample state --- App.js | 15 +++++++++++++-- Note.js | 13 +++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 Note.js diff --git a/App.js b/App.js index 136886f..15b753c 100644 --- a/App.js +++ b/App.js @@ -3,12 +3,23 @@ import Note from './Note.js'; function App(){ return { 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', [ m('.top', [ m('.top-left', [ m('button', {key: 'button'}, 'New Note...'), - m('input.search', {key: 'search'}, {value: ''}), + m('input.search', {key: 'search', value: ''}), m('select.sorting', {key: 'sorting'}, [ m('option', 'Newest -> Oldest'), m('option', 'Oldest -> Newest') diff --git a/Note.js b/Note.js new file mode 100644 index 0000000..8b4f3ad --- /dev/null +++ b/Note.js @@ -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; \ No newline at end of file