UNPKG

676 BJavaScriptView Raw
1import { h } from 'preact'
2
3const baseTitle = `Speedy.gift`
4
5export default ({key, e2e = null, children, title, pageClass, centered, width, innerClass = ''}) => {
6 const builtTitle = title ? `${baseTitle} | ${title}` : baseTitle
7 if (document.title !== builtTitle) {
8 document.title = builtTitle
9 }
10
11 const className = `cf ${centered ? 'center' : ''} ${width ? 'mw' + width : ''} ${pageClass || ''}`
12
13 return (
14 h('article', {
15 key,
16 className,
17 'data-e2e': e2e
18 },
19 h('div', {
20 className: `black-60 tl ${innerClass}`
21 },
22 title && h('h2', {className: 'black-60 ph3 ph0-ns'}, [title]),
23 children
24 )
25 )
26 )
27}