From ed1a1c4478829e13e597c71cbd3adc0906a040fc Mon Sep 17 00:00:00 2001 From: Bing Sun Date: Sun, 26 Apr 2020 09:19:25 +0800 Subject: [PATCH] Layout should be a component --- src/components/Layout.js | 9 +++++++++ src/util/with_layout.js | 15 --------------- 2 files changed, 9 insertions(+), 15 deletions(-) create mode 100644 src/components/Layout.js delete mode 100644 src/util/with_layout.js diff --git a/src/components/Layout.js b/src/components/Layout.js new file mode 100644 index 0000000..1674445 --- /dev/null +++ b/src/components/Layout.js @@ -0,0 +1,9 @@ +export default initial_vnode => { + return { + view: vnode => [ + vnode.attrs.prologue, + m('main', vnode.children), + vnode.attrs.epilogue + ] + } +} diff --git a/src/util/with_layout.js b/src/util/with_layout.js deleted file mode 100644 index 3b60784..0000000 --- a/src/util/with_layout.js +++ /dev/null @@ -1,15 +0,0 @@ -export default options => { - if (typeof options == 'undefined') - options = {} - - if (!options.hasOwnProperty('content')) - options = {'content': options} - - return { - view: vnode => [ - options.prologue, - m('main', options.content), - options.epilogue - ] - } -}