Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function renderError () {
return [
h('h1', [ 'Error combining shards!!!' ]),
h('pre', computed(error, e => (e || '').toString())),
h('div.actions', [
when(modalOpen, h('button -subtle', { 'ev-click': () => modalOpen.set(false) }, 'close'), [])
])
]
}
}
function description ({description, isEditing, onUpdate}) {
const markdown = api.message.html.markdown
const input = h('textarea', {'ev-input': e => onUpdate(e.target.value), value: description})
return h('Description', [
when(isEditing,
input,
computed(description, markdown)
)
])
}
}
function PreviewSetup (strings) {
var showPreview = Value(false)
var previewBtn = h('Button',
{
className: when(showPreview, '-strong', '-subtle'),
'ev-click': () => showPreview.set(!showPreview())
},
when(showPreview, strings.blogNew.actions.edit, strings.blogNew.actions.preview)
)
return { previewBtn, showPreview }
}
var { previewBtn, showPreview } = PreviewSetup(strings)
return nest('message.html.likes', function likes(msg) {
var id = api.keys.sync.id()
var likes = api.message.obs.likes(msg.key)
var iLike = computed(likes, likes => likes.includes(id))
var count = computed(likes, likes => likes.length ? likes.length : '')
return h('Likes', { 'ev-click': () => publishLike(msg, !iLike()) }, [
h('i.fa', { className: when(iLike, 'fa-heart', 'fa-heart-o') }),
h('div.count', count)
])
})
return nest('app.html.lightbox', (content, isOpen) => {
if (typeof isOpen !== 'function') isOpen = Value(false)
const closeMe = () => isOpen.set(false)
const lb = h('Lightbox', { className: when(isOpen, '-open', '-close'), 'ev-click': closeMe },
h('div.content', {'ev-click': (ev) => ev.stopPropagation()},[
content
]))
lb.close = closeMe
return lb
})
}