diff --git a/src/Bulma.purs b/src/Bulma.purs index 1a128a7..99198ae 100644 --- a/src/Bulma.purs +++ b/src/Bulma.purs @@ -69,11 +69,11 @@ input_classes :: forall (r :: Row Type) (i :: Type). Boolean -> HP.IProp ( class input_classes true = HP.classes [ HH.ClassName "input is-small is-info" ] input_classes false = HP.classes [ HH.ClassName "input is-small is-danger" ] ---btn_classes :: forall (r :: Row Type) (i :: Type) --- . Boolean -> HP.IProp ( class :: String | r ) i ---btn_classes true = HP.classes [ HH.ClassName "button is-small is-info" ] ---btn_classes false = HP.classes [ HH.ClassName "button is-small is-danger" ] --- +btn_classes :: forall (r :: Row Type) (i :: Type) + . Boolean -> HP.IProp ( class :: String | r ) i +btn_classes true = HP.classes [ HH.ClassName "button is-small is-info" ] +btn_classes false = HP.classes [ HH.ClassName "button is-small is-danger" ] + --simple_table_header :: forall w i. HH.HTML w i --simple_table_header -- = HH.thead_ [ HH.tr_ [ HH.th [ HP.style "width: 50px;" ] [ HH.text "Type" ] @@ -284,6 +284,18 @@ box_input_password action password validity = HH.label [ ] -- true -> HE.onClick \_ -> action1 -- _ -> HE.onClick \_ -> action2 + +btn :: forall w i. i -> i -> Boolean -> HH.HTML w i +btn title action1 action2 validity + = HH.button + [ btn_add_action validity + , btn_classes validity + ] [ HH.text title ] + where + btn_add_action = case _ of + true -> HE.onClick \_ -> action1 + _ -> HE.onClick \_ -> action2 + p :: forall w i. String -> HH.HTML w i p str = HH.p_ [ HH.text str ]