Mercurial > urweb
annotate tests/dynClassB.ur @ 2153:39bd1d4007a9
Apply syntax sugar for 'class' attribute to <form> as well
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Mon, 08 Jun 2015 11:11:46 -0400 |
parents | f89be9cd2087 |
children |
rev | line source |
---|---|
adam@2121 | 1 style style1 |
adam@2121 | 2 style style2 |
adam@2121 | 3 |
adam@2121 | 4 fun main () : transaction page = |
adam@2121 | 5 toggle <- source False; |
adam@2121 | 6 return <xml> |
adam@2121 | 7 <head> |
adam@2121 | 8 <link rel="stylesheet" type="text/css" href="/style.css"/> |
adam@2121 | 9 </head> |
adam@2121 | 10 <body dynClass={b <- signal toggle; |
adam@2121 | 11 return (if b then style1 else style2)} |
adam@2121 | 12 dynStyle={b <- signal toggle; |
adam@2121 | 13 return (if b then STYLE "margin: 100px" else STYLE "")}> |
adam@2121 | 14 Body |
adam@2121 | 15 <button onclick={fn _ => b <- get toggle; set toggle (not b)}>TOGGLE</button> |
adam@2121 | 16 </body> |
adam@2121 | 17 </xml> |