Add status component

This commit is contained in:
He4eT 2021-03-02 19:29:42 +05:00
commit f02ec6925f
7 changed files with 66 additions and 21 deletions

View file

@ -0,0 +1,23 @@
import { h } from 'preact'
const INITIAL_STATUS = {
stage: 'loading',
details: 'Loading...'
}
const fail = details => (
<div class="status fail">
<h1>Error</h1>
{details.map(x => (<p>{x}</p>))}
<hr />
</div>
)
const loading = details => (
<div class="status loading">
{details.map(x => (<div>{x}</div>))}
</div>
)
export default ({ stage, details }) =>
({fail, loading})[stage](details)