added App options

This commit is contained in:
tmshv committed 2017-05-26 01:19:00 +03:00
1 parent d941878cbe
commit f257e08e7c
2 files changed
+6 -4

No files matched your search

+2 -2
View File
@@ -8,7 +8,7 @@ const Comments = () => (
</div>
)
const App = ({children, menu, showAuthor}) => (
const App = ({children, menu, showAuthor, menuPadding}) => (
<div className="body-wrapper theme-default">
<header>
<div className="navigation">
@@ -19,7 +19,7 @@ const App = ({children, menu, showAuthor}) => (
</header>
<main className="body-wrapper__content">
<section className="content content_full content--padding-top--menu">
<section className={`content content_full ${menuPadding ? 'content--padding-top--menu' : ''}`}>
{children}
</section>
+4 -2
View File
@@ -16,6 +16,7 @@ const config = require('../config')
const defaultOptions = {
commentsEnabled: false,
showAuthor: false,
menuPadding: true,
}
function isActive(path, menuItem) {
@@ -69,17 +70,18 @@ const getTitle = meta => 'title' in meta
const isHtml = data => typeof data === 'string'
async function render(path, data, meta, options = {}) {
const renderOptions = {...defaultOptions, ...options}
const component = isHtml(data)
? getHtml(data)
: data
const menu = buildMenu(path, menuModel)
const content = renderApp({...options, menu, component})
const content = renderApp({...renderOptions, menu, component})
const source = await readFile(config.viewMain, 'utf-8')
const template = handlebars.compile(source)
const renderOptions = {...defaultOptions, ...options}
const metaData = {
...meta,
description: 'Сайт Шлиссельбургской художественной школы',