2024-01-21 17:44:46 +01:00
|
|
|
-- | The `Bulma` module is a wrapper around the BULMA css framework.
|
2023-06-08 21:51:12 +02:00
|
|
|
module Bulma where
|
|
|
|
import Prelude
|
|
|
|
|
|
|
|
import Halogen.HTML as HH
|
2023-07-02 00:05:38 +02:00
|
|
|
import DOM.HTML.Indexed as DHI
|
2023-06-08 21:51:12 +02:00
|
|
|
import Halogen.HTML.Properties as HP
|
|
|
|
import Halogen.HTML.Events as HE
|
2023-07-10 20:15:22 +02:00
|
|
|
import MissingHTMLProperties as MissingProperties
|
2023-06-08 21:51:12 +02:00
|
|
|
|
2023-07-08 01:50:11 +02:00
|
|
|
import CSSClasses as C
|
2023-07-08 00:22:23 +02:00
|
|
|
|
2023-07-12 13:06:36 +02:00
|
|
|
import Halogen.HTML.Core (AttrName(..))
|
2023-06-08 21:51:12 +02:00
|
|
|
-- import Web.Event.Event (type_, Event, EventType(..))
|
2023-07-10 18:14:56 +02:00
|
|
|
import Web.UIEvent.MouseEvent (MouseEvent)
|
2023-06-08 21:51:12 +02:00
|
|
|
|
|
|
|
columns :: forall (w :: Type) (i :: Type).
|
2023-07-08 02:00:23 +02:00
|
|
|
Array HH.ClassName -> Array (HH.HTML w i) -> HH.HTML w i
|
2023-07-08 01:50:11 +02:00
|
|
|
columns classes = HH.div [ HP.classes (C.columns <> classes) ]
|
2023-06-08 21:51:12 +02:00
|
|
|
|
|
|
|
columns_ :: forall (w :: Type) (i :: Type). Array (HH.HTML w i) -> HH.HTML w i
|
|
|
|
columns_ = columns []
|
|
|
|
|
|
|
|
column :: forall (w :: Type) (i :: Type).
|
2023-07-08 02:00:23 +02:00
|
|
|
Array HH.ClassName -> Array (HH.HTML w i) -> HH.HTML w i
|
2023-07-08 01:50:11 +02:00
|
|
|
column classes = HH.div [ HP.classes (C.column <> classes) ]
|
2023-06-08 21:51:12 +02:00
|
|
|
|
|
|
|
column_ :: forall (w :: Type) (i :: Type). Array (HH.HTML w i) -> HH.HTML w i
|
|
|
|
column_ = column []
|
|
|
|
|
|
|
|
h1 :: forall (w :: Type) (a :: Type). String -> HH.HTML w a
|
2023-07-08 01:50:11 +02:00
|
|
|
h1 title = HH.h1 [ HP.classes (C.title) ] [ HH.text title ]
|
2023-06-08 21:51:12 +02:00
|
|
|
|
|
|
|
h3 :: forall (w :: Type) (a :: Type). String -> HH.HTML w a
|
2023-07-09 14:26:47 +02:00
|
|
|
h3 title = HH.h3 [ HP.classes (C.title <> C.is5) ] [ HH.text title ]
|
|
|
|
|
|
|
|
zone_rr_title :: forall (w :: Type) (a :: Type). String -> HH.HTML w a
|
|
|
|
zone_rr_title title
|
|
|
|
= HH.h3 [ HP.classes (C.title <> C.is5 <> C.has_text_light <> C.has_background_dark) ]
|
|
|
|
[ HH.text title ]
|
2023-06-08 21:51:12 +02:00
|
|
|
|
2023-07-10 18:14:56 +02:00
|
|
|
subtitle :: forall (w :: Type) (a :: Type). String -> HH.HTML w a
|
|
|
|
subtitle title = HH.h2 [ HP.classes (C.subtitle <> C.is4) ] [ HH.text title ]
|
|
|
|
|
|
|
|
hdiv :: forall (w :: Type) (a :: Type). Array (HH.HTML w a) -> HH.HTML w a
|
|
|
|
hdiv = HH.div [ HP.classes [HH.ClassName "mt-5"] ]
|
|
|
|
|
2023-06-08 21:51:12 +02:00
|
|
|
--offcolumn :: forall (w :: Type) (a :: Type).
|
|
|
|
-- Int -> Int -> Array (HH.HTML w a) -> HH.HTML w a
|
|
|
|
--offcolumn 0 size = HH.div [ HP.classes [HH.ClassName ("mt-"<>show size)] ]
|
|
|
|
--offcolumn offset size
|
|
|
|
-- = column [ HH.ClassName ("is-offset-" <> (show offset) <> " is-" <> (show size)) ]
|
|
|
|
|
2023-07-10 18:14:56 +02:00
|
|
|
input_classes :: Boolean -> Array HH.ClassName
|
|
|
|
input_classes true = C.input <> C.is_small <> C.is_info
|
|
|
|
input_classes false = C.input <> C.is_small <> C.is_danger
|
2023-06-08 21:51:12 +02:00
|
|
|
|
2023-07-14 21:02:35 +02:00
|
|
|
table :: forall w i. HH.Node DHI.HTMLtable w i
|
|
|
|
table prop xs = HH.table ([ HP.classes $ C.table ] <> prop) xs
|
|
|
|
|
2023-07-10 18:14:56 +02:00
|
|
|
btn_classes :: Boolean -> Array HH.ClassName
|
|
|
|
btn_classes true = C.button <> C.is_small <> C.is_info
|
|
|
|
btn_classes false = C.button <> C.is_small <> C.is_danger
|
2023-06-08 22:00:53 +02:00
|
|
|
|
2023-07-10 18:24:50 +02:00
|
|
|
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" ]
|
2023-07-12 20:38:50 +02:00
|
|
|
, HH.th_ [ HH.text "Name" ]
|
2023-07-10 18:24:50 +02:00
|
|
|
, HH.th_ [ HH.text "TTL" ]
|
2023-07-12 20:38:50 +02:00
|
|
|
, HH.th_ [ HH.text "Target" ]
|
2023-07-10 18:24:50 +02:00
|
|
|
]
|
|
|
|
]
|
|
|
|
|
|
|
|
mx_table_header :: forall w i. HH.HTML w i
|
|
|
|
mx_table_header
|
2023-07-12 20:38:50 +02:00
|
|
|
= HH.thead_ [ HH.tr_ [ HH.th_ [ HH.text "Name" ]
|
2023-07-10 18:24:50 +02:00
|
|
|
, HH.th_ [ HH.text "TTL" ]
|
|
|
|
, HH.th_ [ HH.text "Priority" ]
|
2023-07-12 20:38:50 +02:00
|
|
|
, HH.th_ [ HH.text "Target" ]
|
2023-07-10 18:24:50 +02:00
|
|
|
]
|
|
|
|
]
|
|
|
|
|
|
|
|
srv_table_header :: forall w i. HH.HTML w i
|
|
|
|
srv_table_header
|
2023-07-12 20:38:50 +02:00
|
|
|
= HH.thead_ [ HH.tr_ [ HH.th_ [ HH.text "Name" ]
|
2023-07-10 18:24:50 +02:00
|
|
|
, HH.th_ [ HH.text "TTL" ]
|
|
|
|
, HH.th_ [ HH.text "Priority" ]
|
2023-07-12 01:38:21 +02:00
|
|
|
, HH.th_ [ HH.text "Protocol" ]
|
2023-07-10 18:24:50 +02:00
|
|
|
, HH.th_ [ HH.text "Weight" ]
|
|
|
|
, HH.th_ [ HH.text "Port" ]
|
2023-07-12 20:38:50 +02:00
|
|
|
, HH.th_ [ HH.text "Target" ]
|
2023-07-10 18:24:50 +02:00
|
|
|
]
|
|
|
|
]
|
|
|
|
|
|
|
|
txt_name :: forall w i. String -> HH.HTML w i
|
|
|
|
txt_name t
|
|
|
|
= HH.td [ rr_name_style ] [ rr_name_text ]
|
|
|
|
where
|
|
|
|
rr_name_style = HP.style "width: 80px;"
|
|
|
|
rr_name_text = HH.text t
|
2023-06-08 21:51:12 +02:00
|
|
|
|
|
|
|
input_email :: forall w i. (String -> i) -> String -> Boolean -> HH.HTML w i
|
|
|
|
input_email action "" validity
|
2023-07-10 18:14:56 +02:00
|
|
|
= HH.input [ HE.onValueInput action
|
|
|
|
, HP.placeholder "email"
|
|
|
|
, HP.classes $ input_classes validity
|
|
|
|
]
|
2023-06-08 21:51:12 +02:00
|
|
|
input_email action email validity
|
|
|
|
= HH.input
|
|
|
|
[ HE.onValueInput action
|
|
|
|
, HP.value email
|
|
|
|
, HP.placeholder "email"
|
2023-07-10 18:14:56 +02:00
|
|
|
, HP.classes $ input_classes validity
|
2023-06-08 21:51:12 +02:00
|
|
|
]
|
|
|
|
|
|
|
|
box_input_email :: forall w i. (String -> i) -> String -> Boolean -> HH.HTML w i
|
|
|
|
box_input_email action email validity = HH.label [ ]
|
2023-07-08 01:50:11 +02:00
|
|
|
[ HH.label [HP.classes C.label ] [ HH.text "Email" ]
|
|
|
|
, HH.div [HP.classes C.control ] [ input_email action email validity ]
|
2023-06-08 21:51:12 +02:00
|
|
|
]
|
|
|
|
|
|
|
|
input_password :: forall w i. (String -> i) -> String -> Boolean -> HH.HTML w i
|
|
|
|
input_password action "" validity
|
2023-07-10 18:14:56 +02:00
|
|
|
= HH.input [ HE.onValueInput action
|
|
|
|
, HP.placeholder "password"
|
|
|
|
, HP.classes $ input_classes validity
|
|
|
|
]
|
2023-06-08 21:51:12 +02:00
|
|
|
input_password action password validity
|
|
|
|
= HH.input
|
|
|
|
[ HE.onValueInput action
|
|
|
|
, HP.value password
|
|
|
|
, HP.placeholder "password"
|
2023-07-10 18:14:56 +02:00
|
|
|
, HP.classes $ input_classes validity
|
2023-06-08 21:51:12 +02:00
|
|
|
]
|
|
|
|
|
|
|
|
box_input_password :: forall w i. (String -> i) -> String -> Boolean -> HH.HTML w i
|
|
|
|
box_input_password action password validity = HH.label [ ]
|
2023-07-08 01:50:11 +02:00
|
|
|
[ HH.label [HP.classes C.label ] [ HH.text "Password" ]
|
|
|
|
, HH.div [HP.classes C.control ] [ input_password action password validity ]
|
2023-06-08 21:51:12 +02:00
|
|
|
]
|
|
|
|
|
2023-07-10 18:14:56 +02:00
|
|
|
input_domain :: forall w i. (String -> i) -> String -> Boolean -> HH.HTML w i
|
|
|
|
input_domain action domain validity
|
|
|
|
= HH.input
|
|
|
|
[ HE.onValueInput action
|
|
|
|
, HP.value domain
|
|
|
|
, HP.placeholder "domain"
|
|
|
|
, HP.classes $ input_classes validity
|
|
|
|
]
|
2023-06-08 21:51:12 +02:00
|
|
|
|
2023-07-10 18:14:56 +02:00
|
|
|
box_input_domain :: forall w i. (String -> i) -> String -> Boolean -> HH.HTML w i
|
|
|
|
box_input_domain action domain validity = HH.label [ ]
|
|
|
|
[ HH.label [HP.classes C.label ] [ HH.text "Domain" ]
|
|
|
|
, HH.div [HP.classes C.control ] [ input_domain action domain validity ]
|
|
|
|
]
|
|
|
|
|
|
|
|
input_ttl :: forall w i. (String -> i) -> String -> Boolean -> HH.HTML w i
|
|
|
|
input_ttl action ttl validity
|
|
|
|
= HH.input
|
|
|
|
[ HE.onValueInput action
|
|
|
|
, HP.value ttl
|
2023-07-10 20:15:22 +02:00
|
|
|
, MissingProperties.size 6
|
2023-07-10 18:14:56 +02:00
|
|
|
, HP.placeholder "ttl"
|
|
|
|
, HP.classes $ input_classes validity
|
|
|
|
]
|
|
|
|
|
|
|
|
box_input_ttl :: forall w i. (String -> i) -> String -> Boolean -> HH.HTML w i
|
|
|
|
box_input_ttl action value validity = HH.label [ ]
|
|
|
|
[ HH.label [HP.classes C.label ] [ HH.text "TTL" ]
|
|
|
|
, HH.div [HP.classes C.control ] [ input_ttl action value validity ]
|
|
|
|
]
|
|
|
|
|
|
|
|
input_priority :: forall w i. (String -> i) -> String -> Boolean -> HH.HTML w i
|
|
|
|
input_priority action priority validity
|
|
|
|
= HH.input
|
|
|
|
[ HE.onValueInput action
|
|
|
|
, HP.value priority
|
2023-07-10 20:15:22 +02:00
|
|
|
, MissingProperties.size 6
|
2023-07-10 18:14:56 +02:00
|
|
|
, HP.placeholder "priority"
|
|
|
|
, HP.classes $ input_classes validity
|
|
|
|
]
|
|
|
|
|
|
|
|
box_input_priority :: forall w i. (String -> i) -> String -> Boolean -> HH.HTML w i
|
|
|
|
box_input_priority action value validity = HH.label [ ]
|
|
|
|
[ HH.label [HP.classes C.label ] [ HH.text "Priority" ]
|
|
|
|
, HH.div [HP.classes C.control ] [ input_priority action value validity ]
|
|
|
|
]
|
|
|
|
|
2023-07-12 01:38:21 +02:00
|
|
|
input_protocol :: forall w i. (String -> i) -> String -> Boolean -> HH.HTML w i
|
|
|
|
input_protocol action protocol validity
|
|
|
|
= HH.input
|
|
|
|
[ HE.onValueInput action
|
|
|
|
, HP.value protocol
|
|
|
|
, MissingProperties.size 6
|
|
|
|
, HP.placeholder "_tcp"
|
|
|
|
, HP.classes $ input_classes validity
|
|
|
|
]
|
|
|
|
|
|
|
|
box_input_protocol :: forall w i. (String -> i) -> String -> Boolean -> HH.HTML w i
|
|
|
|
box_input_protocol action value validity = HH.label [ ]
|
|
|
|
[ HH.label [HP.classes C.label ] [ HH.text "Protocol" ]
|
|
|
|
, HH.div [HP.classes C.control ] [ input_protocol action value validity ]
|
|
|
|
]
|
|
|
|
|
2023-07-15 17:53:36 +02:00
|
|
|
-- | For textareas I don't use Bulma's "textarea" class since it doesn't allow to expand
|
|
|
|
-- | textareas horizontaly, which makes edition of TXT records painful.
|
|
|
|
textarea_classes :: Boolean -> Array HH.ClassName
|
|
|
|
textarea_classes true = C.input <> C.is_small <> C.is_info
|
|
|
|
textarea_classes false = C.input <> C.is_small <> C.is_danger
|
|
|
|
|
|
|
|
textarea :: forall w i. (String -> i) -> String -> Boolean -> HH.HTML w i
|
|
|
|
textarea action value validity
|
|
|
|
= HH.textarea
|
|
|
|
[ HE.onValueInput action
|
|
|
|
, HP.value value
|
|
|
|
, HP.placeholder "target"
|
|
|
|
, HP.classes $ textarea_classes validity
|
|
|
|
]
|
|
|
|
|
2023-07-12 20:38:50 +02:00
|
|
|
input_target :: forall w i. (String -> i) -> String -> Boolean -> HH.HTML w i
|
|
|
|
input_target action value validity
|
2023-07-10 18:14:56 +02:00
|
|
|
= HH.input
|
|
|
|
[ HE.onValueInput action
|
|
|
|
, HP.value value
|
2023-07-12 20:38:50 +02:00
|
|
|
, HP.placeholder "target"
|
2023-07-10 18:14:56 +02:00
|
|
|
, HP.classes $ input_classes validity
|
|
|
|
]
|
|
|
|
|
2023-07-12 20:38:50 +02:00
|
|
|
box_input_target :: forall w i. (String -> i) -> String -> Boolean -> HH.HTML w i
|
|
|
|
box_input_target action value validity = HH.label [ ]
|
|
|
|
[ HH.label [HP.classes C.label ] [ HH.text "Target" ]
|
|
|
|
, HH.div [HP.classes C.control ] [ input_target action value validity ]
|
2023-07-10 18:14:56 +02:00
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
input_weight :: forall w i. (String -> i) -> String -> Boolean -> HH.HTML w i
|
|
|
|
input_weight action weight validity
|
|
|
|
= HH.input
|
|
|
|
[ HE.onValueInput action
|
|
|
|
, HP.value weight
|
2023-07-10 20:15:22 +02:00
|
|
|
, MissingProperties.size 6
|
2023-07-10 18:14:56 +02:00
|
|
|
, HP.placeholder "weight"
|
|
|
|
, HP.classes $ input_classes validity
|
|
|
|
]
|
|
|
|
|
|
|
|
box_input_weight :: forall w i. (String -> i) -> String -> Boolean -> HH.HTML w i
|
|
|
|
box_input_weight action weight validity = HH.label [ ]
|
|
|
|
[ HH.label [HP.classes C.label ] [ HH.text "Weight" ]
|
|
|
|
, HH.div [HP.classes C.control ] [ input_weight action weight validity ]
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
input_port :: forall w i. (String -> i) -> String -> Boolean -> HH.HTML w i
|
|
|
|
input_port action port validity
|
|
|
|
= HH.input
|
|
|
|
[ HE.onValueInput action
|
|
|
|
, HP.value port
|
2023-07-10 20:15:22 +02:00
|
|
|
, MissingProperties.size 6
|
2023-07-10 18:14:56 +02:00
|
|
|
, HP.placeholder "port"
|
|
|
|
, HP.classes $ input_classes validity
|
|
|
|
]
|
|
|
|
|
|
|
|
box_input_port :: forall w i. (String -> i) -> String -> Boolean -> HH.HTML w i
|
|
|
|
box_input_port action port validity = HH.label [ ]
|
|
|
|
[ HH.label [HP.classes C.label ] [ HH.text "Port" ]
|
|
|
|
, HH.div [HP.classes C.control ] [ input_port action port validity ]
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
btn_change :: forall w i. i -> i -> Boolean -> Boolean -> HH.HTML w i
|
|
|
|
btn_change action1 action2 modified validity
|
|
|
|
= HH.button
|
|
|
|
[ HP.disabled (not modified)
|
|
|
|
, btn_change_action validity
|
|
|
|
, HP.classes $ btn_classes validity
|
2023-07-12 02:40:30 +02:00
|
|
|
] [ HH.text "save" ]
|
2023-07-10 18:14:56 +02:00
|
|
|
where
|
|
|
|
btn_change_action = case _ of
|
|
|
|
true -> HE.onClick \_ -> action1
|
|
|
|
_ -> HE.onClick \_ -> action2
|
|
|
|
|
|
|
|
btn_delete :: forall w i. (MouseEvent -> i) -> HH.HTML w i
|
|
|
|
btn_delete action
|
|
|
|
= HH.button
|
|
|
|
[ HE.onClick action
|
|
|
|
, HP.classes [ HH.ClassName "button is-small is-danger" ]
|
2023-07-12 02:40:30 +02:00
|
|
|
] [ HH.text "remove" ]
|
2023-07-10 18:14:56 +02:00
|
|
|
|
|
|
|
btn_add :: forall w i. i -> i -> Boolean -> HH.HTML w i
|
|
|
|
btn_add action1 action2 validity
|
|
|
|
= HH.button
|
2024-01-21 02:47:12 +01:00
|
|
|
[ if validity then (HE.onClick \_ -> action1) else (HE.onClick \_ -> action2)
|
2023-07-10 18:14:56 +02:00
|
|
|
, HP.classes $ btn_classes validity
|
|
|
|
] [ HH.text "Add" ]
|
2023-06-08 21:51:12 +02:00
|
|
|
|
2024-01-21 05:33:10 +01:00
|
|
|
-- | Create a `level`, different components that should appear on the same horizontal line.
|
|
|
|
-- | First argument, elements that should appear on the left, second on the right.
|
|
|
|
level :: forall w i. Array (HH.HTML w i) -> Array (HH.HTML w i) -> HH.HTML w i
|
|
|
|
level left right = HH.nav [ HP.classes C.level ]
|
|
|
|
[ HH.div [ HP.classes C.level_left ] $ itemize left
|
|
|
|
, HH.div [ HP.classes C.level_right ] $ itemize right
|
|
|
|
]
|
|
|
|
where itemize = map (\v -> HH.div [ HP.classes C.level_item ] [v])
|
|
|
|
|
2024-01-21 02:47:12 +01:00
|
|
|
btn_add_new_rr :: forall w i. i -> String -> HH.HTML w i
|
|
|
|
btn_add_new_rr action title
|
|
|
|
= HH.button
|
|
|
|
[ HE.onClick \_ -> action
|
|
|
|
, HP.classes $ C.button <> C.is_small <> C.is_info
|
|
|
|
] [ HH.text title ]
|
2023-06-08 22:00:53 +02:00
|
|
|
|
2023-06-13 20:17:27 +02:00
|
|
|
btn :: forall w action. String -> action -> action -> Boolean -> HH.HTML w action
|
2023-06-08 22:00:53 +02:00
|
|
|
btn title action1 action2 validity
|
|
|
|
= HH.button
|
2024-01-21 02:47:12 +01:00
|
|
|
[ if validity then (HE.onClick \_ -> action1) else (HE.onClick \_ -> action2)
|
2023-07-10 18:14:56 +02:00
|
|
|
, HP.classes $ btn_classes validity
|
2023-06-08 22:00:53 +02:00
|
|
|
] [ HH.text title ]
|
|
|
|
|
2023-07-08 03:47:13 +02:00
|
|
|
render_input :: forall w i.
|
2023-07-15 03:23:21 +02:00
|
|
|
Boolean -> String -> String -> (String -> i) -> String -> Boolean -> (HP.IProp DHI.HTMLinput i) -> HH.HTML w i
|
|
|
|
render_input password id placeholder action value validity cond
|
2023-06-09 00:28:03 +02:00
|
|
|
= HH.input $
|
|
|
|
[ HE.onValueInput action
|
|
|
|
, HP.value value
|
|
|
|
, HP.placeholder placeholder
|
2023-07-10 18:14:56 +02:00
|
|
|
, HP.classes $ input_classes validity
|
2023-07-15 03:23:21 +02:00
|
|
|
, HP.id id
|
2023-06-09 00:28:03 +02:00
|
|
|
, cond
|
|
|
|
] <> case password of
|
|
|
|
false -> []
|
|
|
|
true -> [ HP.type_ HP.InputPassword ]
|
|
|
|
|
2023-07-08 03:47:13 +02:00
|
|
|
field_inner :: forall w i.
|
2023-07-15 03:23:21 +02:00
|
|
|
Boolean -> String -> String -> String -> (String -> i) -> String -> Boolean -> (HP.IProp DHI.HTMLinput i) -> HH.HTML w i
|
|
|
|
field_inner ispassword id title placeholder action value validity cond
|
2023-07-03 15:05:40 +02:00
|
|
|
= div_field
|
2023-07-08 03:47:13 +02:00
|
|
|
[ div_field_label
|
2023-07-15 03:23:21 +02:00
|
|
|
, div_field_content $ render_input ispassword id placeholder action value validity cond
|
2023-06-09 00:28:03 +02:00
|
|
|
]
|
2023-07-03 15:05:40 +02:00
|
|
|
where
|
2023-07-10 20:15:22 +02:00
|
|
|
div_field = HH.div [ HP.classes (C.field <> C.is_horizontal) ]
|
2023-07-08 03:47:13 +02:00
|
|
|
div_field_label
|
2023-07-08 01:50:11 +02:00
|
|
|
= HH.div [ HP.classes (C.field_label <> C.normal) ]
|
2023-07-15 03:23:21 +02:00
|
|
|
[HH.label [ HP.classes C.label, HP.for id ] [ HH.text title ]]
|
2023-07-03 15:05:40 +02:00
|
|
|
div_field_content content
|
2023-07-08 03:47:13 +02:00
|
|
|
= HH.div [ HP.classes C.field_body ]
|
2023-07-08 01:50:11 +02:00
|
|
|
[ HH.div [HP.classes C.field ]
|
|
|
|
[ HH.div [HP.classes C.control ] [ content ]
|
2023-07-03 15:05:40 +02:00
|
|
|
]
|
|
|
|
]
|
2023-06-09 00:28:03 +02:00
|
|
|
|
2023-07-08 03:47:13 +02:00
|
|
|
box_input :: forall w i.
|
2023-07-15 03:23:21 +02:00
|
|
|
String -> String -> String -> (String -> i) -> String -> Boolean -> (HP.IProp DHI.HTMLinput i) -> HH.HTML w i
|
2023-07-03 15:05:40 +02:00
|
|
|
box_input = field_inner false
|
2024-02-03 18:57:38 +01:00
|
|
|
|
2023-07-08 03:47:13 +02:00
|
|
|
box_password :: forall w i.
|
2023-07-15 03:23:21 +02:00
|
|
|
String -> String -> String -> (String -> i) -> String -> Boolean -> (HP.IProp DHI.HTMLinput i) -> HH.HTML w i
|
2023-07-03 15:05:40 +02:00
|
|
|
box_password = field_inner true
|
2023-06-09 00:28:03 +02:00
|
|
|
|
2023-07-08 04:00:32 +02:00
|
|
|
section_small :: forall w i. Array (HH.HTML w i) -> HH.HTML w i
|
|
|
|
section_small = HH.section [ HP.classes (C.section <> C.is_small) ]
|
|
|
|
|
2023-07-08 02:00:23 +02:00
|
|
|
section_medium :: forall w i. Array (HH.HTML w i) -> HH.HTML w i
|
2023-07-08 01:50:11 +02:00
|
|
|
section_medium = HH.section [ HP.classes (C.section <> C.medium) ]
|
2023-07-05 06:50:30 +02:00
|
|
|
|
2023-07-08 02:00:23 +02:00
|
|
|
field :: forall w i. Array HH.ClassName -> Array (HH.HTML w i) -> HH.HTML w i
|
2023-07-08 01:50:11 +02:00
|
|
|
field classes = HH.div [ HP.classes (C.field <> classes) ]
|
2023-07-05 07:00:42 +02:00
|
|
|
|
2023-07-08 03:47:13 +02:00
|
|
|
new_domain_field :: forall w i.
|
|
|
|
(String -> i) -> String -> Array (HP.IProp DHI.HTMLselect i) -> Array String -> HH.HTML w i
|
2023-07-05 06:50:30 +02:00
|
|
|
new_domain_field inputaction text selectaction accepted_domains
|
2023-07-08 01:50:11 +02:00
|
|
|
= field C.has_addons
|
2023-07-05 06:50:30 +02:00
|
|
|
[ HH.p
|
2023-07-08 01:50:11 +02:00
|
|
|
[ HP.classes C.control ]
|
2023-07-05 06:50:30 +02:00
|
|
|
[ HH.input $
|
|
|
|
[ HE.onValueInput inputaction
|
|
|
|
, HP.placeholder "www"
|
|
|
|
, HP.value text
|
|
|
|
, HP.type_ HP.InputText
|
2023-07-08 01:50:11 +02:00
|
|
|
, HP.classes (C.is_primary <> C.input)
|
2023-07-05 06:50:30 +02:00
|
|
|
]
|
|
|
|
]
|
|
|
|
, HH.p
|
2023-07-08 01:50:11 +02:00
|
|
|
[ HP.classes C.control ]
|
2023-07-05 06:50:30 +02:00
|
|
|
[ select selectaction $ map option accepted_domains ]
|
|
|
|
, HH.p
|
2023-07-08 01:50:11 +02:00
|
|
|
[ HP.classes C.control ]
|
2023-07-05 06:50:30 +02:00
|
|
|
[ HH.button
|
|
|
|
[ HP.type_ HP.ButtonSubmit
|
2023-07-08 01:50:11 +02:00
|
|
|
, HP.classes C.button
|
2023-07-05 06:50:30 +02:00
|
|
|
]
|
|
|
|
[ HH.text "add a new domain!" ]
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|
2023-06-13 20:17:27 +02:00
|
|
|
--box_button action value validity cond
|
|
|
|
-- = HH.label [ ]
|
2023-07-08 01:50:11 +02:00
|
|
|
-- [ HH.label [HP.classes C.label ] [ HH.text title ]
|
|
|
|
-- , HH.div [HP.classes C.control ]
|
2023-06-13 20:17:27 +02:00
|
|
|
-- [ render_input ispassword placeholder action value validity cond ]
|
|
|
|
-- ]
|
|
|
|
|
2023-07-22 15:44:32 +02:00
|
|
|
code :: forall w i. String -> HH.HTML w i
|
|
|
|
code str = HH.code_ [ HH.text str ]
|
|
|
|
|
|
|
|
text :: forall w i. String -> HH.HTML w i
|
|
|
|
text = HH.text
|
|
|
|
|
2023-06-08 21:51:12 +02:00
|
|
|
p :: forall w i. String -> HH.HTML w i
|
|
|
|
p str = HH.p_ [ HH.text str ]
|
|
|
|
|
2023-07-15 03:23:21 +02:00
|
|
|
p_ :: forall w i. Array HH.ClassName -> String -> HH.HTML w i
|
|
|
|
p_ classes str = HH.p [HP.classes classes] [ HH.text str ]
|
|
|
|
|
2023-06-08 21:51:12 +02:00
|
|
|
box :: forall w i. Array (HH.HTML w i) -> HH.HTML w i
|
2023-07-08 01:50:11 +02:00
|
|
|
box = HH.div [HP.classes C.box]
|
2023-07-01 17:32:15 +02:00
|
|
|
|
|
|
|
option :: forall w i. String -> HH.HTML w i
|
|
|
|
option value = HH.option_ [HH.text value]
|
|
|
|
|
2023-07-02 00:05:38 +02:00
|
|
|
select :: forall w i. HH.Node DHI.HTMLselect w i
|
|
|
|
select action options
|
2023-07-08 01:50:11 +02:00
|
|
|
= HH.div [ HP.classes (C.select <> C.is_primary) ]
|
2023-07-02 00:05:38 +02:00
|
|
|
[ HH.select action options]
|
2023-07-05 06:50:30 +02:00
|
|
|
|
|
|
|
hero :: forall w i. String -> String -> HH.HTML w i
|
2023-07-12 13:06:36 +02:00
|
|
|
hero _title _subtitle
|
2023-07-08 01:50:11 +02:00
|
|
|
= HH.section [ HP.classes (C.hero <> C.is_info <> C.is_small) ]
|
|
|
|
[ HH.div [ HP.classes C.hero_body ]
|
2023-07-12 13:06:36 +02:00
|
|
|
[ HH.p [ HP.classes C.title ] [ HH.text _title ]
|
|
|
|
, HH.p [ HP.classes C.subtitle ] [ HH.text _subtitle ]
|
2023-07-05 06:50:30 +02:00
|
|
|
]
|
|
|
|
]
|
|
|
|
|
2023-07-15 16:30:02 +02:00
|
|
|
hero_danger :: forall w i. String -> String -> HH.HTML w i
|
|
|
|
hero_danger _title _subtitle
|
|
|
|
= HH.section [ HP.classes (C.hero <> C.is_danger <> C.is_small) ]
|
|
|
|
[ HH.div [ HP.classes C.hero_body ]
|
|
|
|
[ HH.p [ HP.classes C.title ] [ HH.text _title ]
|
|
|
|
, HH.p [ HP.classes C.subtitle ] [ HH.text _subtitle ]
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|
2023-07-05 06:50:30 +02:00
|
|
|
header :: forall w i. String -> String -> HH.HTML w i
|
|
|
|
header = hero
|
|
|
|
|
|
|
|
container :: forall w i. Array (HH.HTML w i) -> HH.HTML w i
|
2023-07-08 01:50:11 +02:00
|
|
|
container = HH.div [HP.classes (C.container <> C.is_info)]
|
2023-07-08 00:22:23 +02:00
|
|
|
|
|
|
|
data_target :: forall r i. String -> HP.IProp r i
|
|
|
|
data_target = HP.attr (AttrName "data-target")
|
|
|
|
|
2024-01-21 02:47:12 +01:00
|
|
|
modal :: forall w i. Array (HH.HTML w i) -> HH.HTML w i
|
|
|
|
modal = HH.div [HP.classes (C.modal <> C.is_active)]
|
|
|
|
modal_background :: forall w i. HH.HTML w i
|
|
|
|
modal_background = HH.div [HP.classes C.modal_background] []
|
|
|
|
modal_card :: forall w i. Array (HH.HTML w i) -> HH.HTML w i
|
|
|
|
modal_card = HH.div [HP.classes C.modal_card]
|
|
|
|
modal_header :: forall w i. String -> HH.HTML w i
|
|
|
|
modal_header title = HH.header [HP.classes C.modal_card_head]
|
|
|
|
[ HH.p [HP.classes C.modal_card_title] [HH.text title]
|
|
|
|
]
|
2024-01-21 02:51:49 +01:00
|
|
|
modal_body :: forall w i. Array (HH.HTML w i) -> HH.HTML w i
|
2024-01-21 05:33:10 +01:00
|
|
|
modal_body = HH.section [HP.classes C.modal_card_body]
|
2024-01-21 02:47:12 +01:00
|
|
|
modal_foot :: forall w i. Array (HH.HTML w i) -> HH.HTML w i
|
|
|
|
modal_foot = HH.div [HP.classes C.modal_card_foot]
|
|
|
|
|
|
|
|
modal_cancel_button :: forall w i. i -> HH.HTML w i
|
|
|
|
modal_cancel_button action
|
|
|
|
= HH.button [ HP.classes C.button
|
|
|
|
, HE.onClick \_ -> action
|
|
|
|
] [HH.text "Cancel"]
|
|
|
|
|
2023-07-08 01:50:11 +02:00
|
|
|
modal_domain_delete :: forall w i. String -> HH.HTML w i
|
|
|
|
modal_domain_delete domain =
|
|
|
|
modal
|
|
|
|
[ modal_background
|
2024-01-21 02:47:12 +01:00
|
|
|
, modal_card [modal_header "Deleting a domain", modal_body]
|
2023-07-08 01:50:11 +02:00
|
|
|
, modal_foot [modal_delete_button, modal_cancel_button]
|
|
|
|
]
|
|
|
|
where
|
2024-01-21 02:47:12 +01:00
|
|
|
-- modal_header = HH.header [HP.classes C.modal_card_head]
|
|
|
|
-- [ HH.p [HP.classes C.modal_card_title] [HH.text "Deleting a domain"]
|
|
|
|
-- --, HH.button [HP.classes C.delete, ARIA.label "close"] []
|
|
|
|
-- ]
|
2023-07-08 01:50:11 +02:00
|
|
|
modal_body = HH.section [HP.classes C.modal_card_body] [ warning_message ]
|
2024-01-21 02:47:12 +01:00
|
|
|
-- modal_foot = HH.div [HP.classes C.modal_card_foot]
|
2023-07-08 01:50:11 +02:00
|
|
|
modal_delete_button = HH.button [HP.classes (C.button <> C.is_success)] [HH.text "Delete the domain."]
|
|
|
|
modal_cancel_button = HH.button [HP.classes C.button] [HH.text "Cancel"]
|
|
|
|
warning_message
|
|
|
|
= HH.p [] [ HH.text $ "You are about to delete your domain '"
|
|
|
|
<> domain
|
|
|
|
<> "'. Are you sure you want to do this? This is "
|
|
|
|
, HH.strong_ [ HH.text "irreversible" ]
|
|
|
|
, HH.text "."
|
|
|
|
]
|
2023-07-09 14:26:47 +02:00
|
|
|
|
2023-07-23 03:29:19 +02:00
|
|
|
strong :: forall w i. String -> HH.HTML w i
|
|
|
|
strong str = HH.strong_ [ HH.text str ]
|
|
|
|
|
2023-07-09 14:26:47 +02:00
|
|
|
hr :: forall w i. HH.HTML w i
|
|
|
|
hr = HH.hr_
|
|
|
|
|
2024-02-03 18:57:38 +01:00
|
|
|
tile :: forall w i. Array HH.ClassName -> Array (HH.HTML w i) -> HH.HTML w i
|
|
|
|
tile classes = HH.div [HP.classes (C.tile <> classes)]
|
|
|
|
|
|
|
|
tile_ :: forall w i. Array (HH.HTML w i) -> HH.HTML w i
|
|
|
|
tile_ = tile []
|
|
|
|
|
|
|
|
tile_danger :: forall w i. Array HH.ClassName -> Array (HH.HTML w i) -> HH.HTML w i
|
|
|
|
tile_danger classes = tile (C.is_danger <> C.notification <> classes)
|
|
|
|
|
|
|
|
tile_warning :: forall w i. Array HH.ClassName -> Array (HH.HTML w i) -> HH.HTML w i
|
|
|
|
tile_warning classes = tile (C.is_warning <> C.notification <> classes)
|
|
|
|
|
|
|
|
article_ :: forall w i. Array HH.ClassName -> HH.HTML w i -> HH.HTML w i -> HH.HTML w i
|
|
|
|
article_ classes head body = HH.article [HP.classes (C.message <> classes)]
|
|
|
|
[ HH.div [HP.classes C.message_header] [head]
|
|
|
|
, HH.div [HP.classes C.message_body ] [body]
|
|
|
|
]
|
|
|
|
|
|
|
|
article :: forall w i. HH.HTML w i -> HH.HTML w i -> HH.HTML w i
|
|
|
|
article head body = article_ [] head body
|
|
|
|
|
|
|
|
error_message :: forall w i. HH.HTML w i -> HH.HTML w i -> HH.HTML w i
|
|
|
|
error_message head body = article_ C.is_danger head body
|