2019-11-20 19:22:51 +01:00
|
|
|
|
|
|
|
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
|
2019-12-12 01:49:34 +01:00
|
|
|
textarea: (args, children) ->
|
|
|
|
h \textarea.textarea args, children
|
2019-12-12 02:30:46 +01:00
|
|
|
control: (selector, args, children) ->
|
|
|
|
if typeof(selector) == "object"
|
|
|
|
children = args
|
|
|
|
args = selector
|
|
|
|
selector = ""
|
|
|
|
|
|
|
|
h (\div.control + selector), args, children
|
|
|
|
button: (selector, args, children) ->
|
|
|
|
if typeof(selector) == "object"
|
|
|
|
children = args
|
|
|
|
args = selector
|
|
|
|
selector = ""
|
|
|
|
|
|
|
|
h (\div.button + selector), args, children
|
|
|
|
tag: (selector, args, children) ->
|
|
|
|
if typeof(selector) == "object"
|
|
|
|
children = args
|
|
|
|
args = selector
|
|
|
|
selector = ""
|
|
|
|
|
|
|
|
h (\div.tag + selector), args, children
|
|
|
|
|
2019-12-12 01:49:34 +01:00
|
|
|
select: (selector, args, children) ->
|
|
|
|
if typeof(selector) == "object"
|
|
|
|
children = args
|
|
|
|
args = selector
|
2019-12-12 02:30:46 +01:00
|
|
|
selector = ""
|
2019-12-12 01:49:34 +01:00
|
|
|
|
|
|
|
h (\div.select + selector), {
|
|
|
|
} [
|
|
|
|
h \select {
|
|
|
|
onchange: args.onchange || ->
|
|
|
|
} children
|
|
|
|
]
|
2019-11-20 19:22:51 +01:00
|
|
|
|
|
|
|
# FIXME: Use only args and add args.label and args.input?
|
|
|
|
# Or maybe args.name and args.type could be used directly?
|
2019-12-12 02:30:46 +01:00
|
|
|
field: (selector, args, children) ->
|
|
|
|
if typeof(selector) == "object"
|
|
|
|
children = args
|
|
|
|
args = selector
|
|
|
|
selector = ""
|
|
|
|
|
|
|
|
h (\div.field + selector), args, children
|
2019-11-20 19:22:51 +01:00
|
|
|
|
|
|
|
form: (method, url, content) ->
|
|
|
|
h \form.form {
|
|
|
|
action: url
|
|
|
|
method: method
|
|
|
|
}, content
|
2019-12-24 22:24:22 +01:00
|
|
|
media: (args) ->
|
|
|
|
h \div.media [
|
|
|
|
if args.left
|
|
|
|
h \div.media-left args.left
|
|
|
|
if args.content
|
|
|
|
h \div.media-content args.content
|
|
|
|
if args.right
|
|
|
|
h \div.media-right args.right
|
|
|
|
]
|
|
|
|
level: (args) ->
|
|
|
|
h \div.level [
|
|
|
|
if args.left
|
|
|
|
h \div.level-left args.left
|
|
|
|
if args.right
|
|
|
|
h \div.level-right args.right
|
|
|
|
]
|
2019-11-20 19:22:51 +01:00
|
|
|
}
|
|
|
|
|