Blaze Layout Component
A simple Blaze Component for use with Flow Router's layout manager.
Adding this package to your Meteor application adds BlazeLayoutComponent
class
into the global scope. It also configures the root Blaze Component to serve as the root of the components' tree.
Client side only.
Installation
meteor add peerlibrary:blaze-layout-component
Usage
Define your layout component:
<template name="ColumnsLayoutComponent"> <main> <div class="row"> <div class="first col s4"> </div> <div class="second col s4"> </div> <div class="third col s4"> </div> </div> </main> </template>
1class ColumnsLayoutComponent extends BlazeLayoutComponent { 2 renderFirst(parentComponent) { 3 this._renderRegion('first', parentComponent); 4 } 5 6 renderSecond(parentComponent) { 7 this._renderRegion('second', parentComponent); 8 } 9 10 renderThird(parentComponent) { 11 this._renderRegion('third', parentComponent); 12 } 13} 14 15ColumnsLayoutComponent.register('ColumnsLayoutComponent');
Then you can define a route using this layout:
1FlowRouter.route('/post/:_id', { 2 name: 'Post.display' 3 action: function (params, queryParams) { 4 BlazeLayout.render('ColumnsLayoutComponent', { 5 first: 'FirstComponent', 6 second: 'SecondComponent', 7 third: 'ThirdComponent' 8 }); 9 } 10});