diff examples/popup.ur @ 6:f17b869fbb71

Shifting some generic theme navigation menu code to the library.
author Karn Kallio <kkallio@eka>
date Tue, 26 Apr 2011 20:27:04 -0430
parents
children 48a4180171b0
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/popup.ur	Tue Apr 26 20:27:04 2011 -0430
@@ -0,0 +1,40 @@
+open Navbar
+open PopupNav
+
+val testNav = navAdd (mkNavItem "item 2" (bless "http://item2.org")) 
+                     (navAdd (mkNavItem "item 1" (bless "http://item1.org"))
+                             emptyNavBar)
+
+val testNav' = navAdd (mkNavItem "item 3" (bless "http://item3.org")) 
+                      testNav
+
+val otherFormat = {FormatMenu = fn ctl menu => <xml><h3>A Custom {ctl} Format</h3><ul>{menu}</ul></xml>,
+                   OpenCtl = fn behaviour => <xml><a href={bless "http://#"} onclick={behaviour}>View</a></xml>,
+                   CloseCtl = fn behaviour => <xml><a href={bless "http://#"} onclick={behaviour}>Hide</a></xml>}
+
+
+fun main () =
+
+    defaultFormatPopUp <- create defaultFormat testNav';
+    otherFormatPopUp <- create otherFormat testNav';
+
+    return <xml>
+      <head>
+        <title>Navbar Based Popup Navigation.</title>
+      </head>
+      <body>
+        <h1>Example of using Navbar to build a widget.</h1>
+        <p>
+          This is a widget which generates a popup list
+          of links.
+        </p>
+        <h2>Example of the default format.</h2>
+        <p>
+          {render defaultFormatPopUp}
+        </p>
+        <h2>Example of another format.</h2>
+        <p>
+          {render otherFormatPopUp}
+        </p>
+      </body>
+    </xml>