added App options
This commit is contained in:
1 parent
d941878cbe
commit
f257e08e7c
2 files changed
+6
-4
No files matched your search
@@ -8,7 +8,7 @@ const Comments = () => (
|
|||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
||||||
const App = ({children, menu, showAuthor}) => (
|
const App = ({children, menu, showAuthor, menuPadding}) => (
|
||||||
<div className="body-wrapper theme-default">
|
<div className="body-wrapper theme-default">
|
||||||
<header>
|
<header>
|
||||||
<div className="navigation">
|
<div className="navigation">
|
||||||
@@ -19,7 +19,7 @@ const App = ({children, menu, showAuthor}) => (
|
|||||||
</header>
|
</header>
|
||||||
|
|
||||||
<main className="body-wrapper__content">
|
<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}
|
{children}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|||||||
+4
-2
@@ -16,6 +16,7 @@ const config = require('../config')
|
|||||||
const defaultOptions = {
|
const defaultOptions = {
|
||||||
commentsEnabled: false,
|
commentsEnabled: false,
|
||||||
showAuthor: false,
|
showAuthor: false,
|
||||||
|
menuPadding: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
function isActive(path, menuItem) {
|
function isActive(path, menuItem) {
|
||||||
@@ -69,17 +70,18 @@ const getTitle = meta => 'title' in meta
|
|||||||
const isHtml = data => typeof data === 'string'
|
const isHtml = data => typeof data === 'string'
|
||||||
|
|
||||||
async function render(path, data, meta, options = {}) {
|
async function render(path, data, meta, options = {}) {
|
||||||
|
const renderOptions = {...defaultOptions, ...options}
|
||||||
|
|
||||||
const component = isHtml(data)
|
const component = isHtml(data)
|
||||||
? getHtml(data)
|
? getHtml(data)
|
||||||
: data
|
: data
|
||||||
|
|
||||||
const menu = buildMenu(path, menuModel)
|
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 source = await readFile(config.viewMain, 'utf-8')
|
||||||
const template = handlebars.compile(source)
|
const template = handlebars.compile(source)
|
||||||
|
|
||||||
const renderOptions = {...defaultOptions, ...options}
|
|
||||||
const metaData = {
|
const metaData = {
|
||||||
...meta,
|
...meta,
|
||||||
description: 'Сайт Шлиссельбургской художественной школы',
|
description: 'Сайт Шлиссельбургской художественной школы',
|
||||||
|
|||||||
Reference in new issue
Block a user