base widgets pasted by iterrogo on Fri Jun 20 18:26:27 2014
(define-syntax widget (syntax-rules () ((_ name markup_ attributes_) (add-widget name `((markup . `(*TOP* markup_)) (attributes . attributes_)))))) (widget 'stylesheet (link (@ (href ,(string-append "/res/css/" path)) (type "text/css") (rel "stylesheet"))) ((path ""))) (widget 'row (div (@ (class "row")) ,@contents) ()) (widget 'column-layout ,(let ((class (++ "column small-" (number->string (inexact->exact (round (/ 12 (length contents)))))))) `(div (@ (class "row")) ,@(map (lambda (col) `(div (@ (class ,class)) ,col)) contents) ,(if fill-row `(div (@ (class "column end"))) ""))) ((fill-row #t))) (widget 'group-box (div (@ (class "panel group-box")) (h4 (@ (class "group-box-title")) ,title) ,@contents) ((title ""))) (widget 'radio-button (label (input (@ (type "radio") (name ,name))) ,label) ((name "radio1") (label "radio1"))) (widget 'spacer (div (@ (class "spacer")) ,@contents) ()) (widget 'modal (div (@ (class "modal-overlay")) (div (@ (class "modal-content")) ,@contents)) ())
with widget example added by iterrogo on Fri Jun 20 18:28:03 2014
(widget
'buy-or-sell-center
(group-box
(@ (title " Buy or Sell"))
(div
,(map (lambda (stock)
`(label (@ (class "inline-label"))
(input (@ (type "radio") (value ,(stock-name stock))
(name "buy-stock-name-input"))
" " ,(stock-name stock))
(br))) stocks))
(div (column-layout
(label "shares: "
(input (@ (id "number-of-shares") (type "text") (name "shares"))))
(label "money: "
(input (@ (type "text") (name "money") (id "buy-money-input")))))
(column-layout (button (@ (class "button tiny expand") (name "buy-sell")
(id "buy-shares") (type "submit")) "buy")
(button (@ (class "button tiny expand") (name "buy-sell")
(id "sell-shares") (type "submit")) "sell"))))