const FormDescription = match({
source: $pending,
cases: {
true: Alert,
false: Info,
},
})
const Panel = match({
source: $error,
bind: {
text: $text,
},
cases: {
username_is_invalid: Alert,
username_is_abandoned: Info,
ok: Success,
},
})
const Alert = reflect({
bind: {
type: $store.map(fn),
},
view: Notification,
})
const Field = match({
source: $field.map(field => field.type),
bind: {
text: $text,
},
cases: {
text: Input,
number: Range,
boolean: Checkbox,
select: Select,
field: Textarea,
},
default: () => null,
})
function match({ source, cases, bind, default: Default }) {
return (props) => <Default />
}