1 | import { h } from 'preact'
|
2 | const toOmit = {
|
3 | children: true,
|
4 | single: true,
|
5 | title: true,
|
6 | centered: true,
|
7 | className: true
|
8 | }
|
9 | const getRest = props => {
|
10 | const rest = {}
|
11 | for (const key in props) {
|
12 | if (!toOmit[key]) {
|
13 | rest[key] = props[key]
|
14 | }
|
15 | }
|
16 | return rest
|
17 | }
|
18 |
|
19 | export default props => {
|
20 | const {children, single, title, centered, className} = props
|
21 | const rest = getRest(props)
|
22 | return (
|
23 | h('div', Object.assign(
|
24 | {className: `fl w-100 pb3 pb0-l ph3 ph0-ns ${single ? '' : 'w-50-l'} ${className || ''}`},
|
25 | rest
|
26 | ), [
|
27 | h('div', {className: `${centered ? 'tc' : 'tl'}`}, [
|
28 | title && h('h3', null, [title]),
|
29 | children
|
30 | ])
|
31 | ])
|
32 | )
|
33 | }
|