Use inline tags for messages

This commit is contained in:
He4eT 2021-02-28 20:17:13 +05:00
commit 23714c7e7f
2 changed files with 14 additions and 21 deletions

View file

@ -1,16 +1,14 @@
import { h } from 'preact'
export default function ({ style, text }) {
const defaultContent = (<span>{text}</span>)
const defaultContent = (
<span class={['message', style].join(' ')}>
{text}
</span>)
const content = ({
emptyLine: (<br />),
subheader: (<strong>{text}</strong>)
return ({
input: (<span class='message input'>&gt; {text}</span>),
subheader: (<strong>{text}</strong>),
endOfLine: (<br />)
})[style] || defaultContent
return (
<div class={['message', style].join(' ')}>
{content}
</div>
)
}