1. dp wiz
  2. layout-bootstrap

Commits

dp wiz  committed 406ff44

extra fun with buttons

  • Participants
  • Parent commits fa96f8e
  • Branches default

Comments (0)

Files changed (1)

File Layout/Bootstrap/Widgets.hs

View file
  • Ignore whitespace
 button type_ classes body = H.button ! A.type_ (toValue type_) ! A.class_ mkClasses $ body
     where mkClasses = toValue $ T.unwords $ "btn" : classes
 
+buttonGroup :: Html -> Html
+buttonGroup body = H.div ! A.class_ "btn-group" $ body
+
+buttonBar :: Html -> Html
+buttonBar body = H.div ! A.class_ "btn-toolbar" $ body
+
+-- Button/Dropdown
+buttonDD :: T.Text -> Html -> Html
+buttonDD action body = buttonGroup $ do
+    H.a ! A.class_ "btn dropdown-toggle" ! H.dataAttribute "toggle" "dropdown" ! A.href "#" $ do
+        toHtml action
+        H.span ! A.class_ "caret" $ mempty
+    H.ul ! A.class_ "dropdown-menu" $ body
+
+-- Button/Dropdown with a caret in a split section
+buttonSDD :: T.Text -> Html -> Html
+buttonSDD action body = buttonGroup $ do
+    H.a ! A.class_ "btn" ! A.href "#" $ toHtml action
+    H.a ! A.class_ "btn dropdown-toggle" ! H.dataAttribute "toggle" "dropdown" ! A.href "#" $
+        H.span ! A.class_ "caret" $ mempty
+    H.ul ! A.class_ "dropdown-menu" $ body
+
 -- Layout
 
 section :: T.Text -> Html -> Html