#lang planet dyoo/whalesong
(require (planet dyoo/whalesong/web-world)
(planet dyoo/whalesong/resource))
(define-resource index.html)
(define (make-item name)
(view-bind (->view `(li ,name))
"click"
hide-on-click))
(define (hide-on-click w v)
(remove (view-id v) w))
(define dwarf-names
'("Doc" "Grumpy" "Happy" "Sleepy" "Bashful" "Sneezy" "Dopey"))
(define (draw w dom-view)
(foldl (lambda (name view)
(cond [(view-focus? view name)
(define focused (view-focus view name))
(cond
[(member name w)
view]
[else
(view-remove focused)])]
[else
view]))
dom-view
dwarf-names))
(define my-view
(view-bind-many* (->view index.html)
(map (lambda (name)
(list name "click" hide-on-click))
dwarf-names)))
(big-bang dwarf-names
(initial-view my-view)
(to-draw draw))