49 lines
1015 B
Plaintext
49 lines
1015 B
Plaintext
|
|
h = require 'maquette' .h
|
|
|
|
module.exports = {
|
|
box: (args, children) ->
|
|
h \div.box args, children
|
|
title: (level, args, label) ->
|
|
if not label
|
|
label = args
|
|
args = {}
|
|
|
|
h "div.title.is-#{level}", args, [label]
|
|
label: (args, label) ->
|
|
if not label
|
|
label = args
|
|
args = {}
|
|
|
|
h \label.label args, [label]
|
|
input: (args, children) ->
|
|
h \input.input args, children
|
|
textarea: (args, children) ->
|
|
h \textarea.textarea args, children
|
|
control: (args, children) ->
|
|
h \div.control args, children
|
|
select: (selector, args, children) ->
|
|
if typeof(selector) == "object"
|
|
children = args
|
|
args = selector
|
|
|
|
h (\div.select + selector), {
|
|
} [
|
|
h \select {
|
|
onchange: args.onchange || ->
|
|
} children
|
|
]
|
|
|
|
# FIXME: Use only args and add args.label and args.input?
|
|
# Or maybe args.name and args.type could be used directly?
|
|
field: (args, children) ->
|
|
h \div.field args, children
|
|
|
|
form: (method, url, content) ->
|
|
h \form.form {
|
|
action: url
|
|
method: method
|
|
}, content
|
|
}
|
|
|