53 lines
2 KiB
Text
53 lines
2 KiB
Text
module Web.Notification where
|
|
|
|
import Prelude (($), (<>))
|
|
import Web.Field
|
|
|
|
import Halogen.HTML as HH
|
|
import Halogen.HTML.Properties as HP
|
|
|
|
import CSSClasses as C
|
|
import Web.Button (delete_btn)
|
|
|
|
notification :: forall w i. Array HH.ClassName -> String -> i -> HH.HTML w i
|
|
notification classes value deleteaction =
|
|
HH.div [HP.classes $ [C.notification] <> classes]
|
|
[ delete_btn deleteaction
|
|
, HH.text value
|
|
]
|
|
|
|
notification_primary :: forall w i. String -> i -> HH.HTML w i
|
|
notification_primary value action = notification [C.is_primary] value action
|
|
|
|
notification_success :: forall w i. String -> i -> HH.HTML w i
|
|
notification_success value action = notification [C.is_success] value action
|
|
|
|
notification_warning :: forall w i. String -> i -> HH.HTML w i
|
|
notification_warning value action = notification [C.is_warning] value action
|
|
|
|
notification_danger :: forall w i. String -> i -> HH.HTML w i
|
|
notification_danger value action = notification [C.is_danger] value action
|
|
|
|
notification_block' :: forall w i. Array HH.ClassName -> Array (HH.HTML w i) -> HH.HTML w i
|
|
notification_block' classes content =
|
|
HH.div [HP.classes ([C.notification] <> classes)] content
|
|
|
|
notification' :: forall w i. Array HH.ClassName -> String -> HH.HTML w i
|
|
notification' classes value =
|
|
HH.div [HP.classes ([C.notification] <> classes)]
|
|
[ HH.text value ]
|
|
|
|
notification_primary' :: forall w i. String -> HH.HTML w i
|
|
notification_primary' value = notification' [C.is_primary] value
|
|
|
|
notification_warning' :: forall w i. String -> HH.HTML w i
|
|
notification_warning' value = notification' [C.is_warning] value
|
|
|
|
notification_danger' :: forall w i. String -> HH.HTML w i
|
|
notification_danger' value = notification' [C.is_danger] value
|
|
|
|
notification_danger_block' :: forall w i. Array (HH.HTML w i) -> HH.HTML w i
|
|
notification_danger_block' content = notification_block' [C.is_danger] content
|
|
|
|
error_box :: forall w i. String -> String -> String -> HH.HTML w i
|
|
error_box id title value = error_field_entry id title $ notification_danger' value
|