Remove now useless App.Style module.
parent
c0db4a93e0
commit
b976cd2ebc
|
@ -1,269 +0,0 @@
|
|||
module App.Style where
|
||||
|
||||
import Prelude
|
||||
|
||||
import CSSClasses as C
|
||||
import Halogen.HTML as HH
|
||||
import Halogen.HTML.Properties as HP
|
||||
import Halogen.HTML.Events as HE
|
||||
|
||||
-- HTML PropName used with HP.prop
|
||||
import Halogen.HTML.Core (PropName(..))
|
||||
-- import Web.Event.Event (type_, Event, EventType(..))
|
||||
import Web.UIEvent.MouseEvent (MouseEvent)
|
||||
|
||||
columns :: forall (w :: Type) (i :: Type).
|
||||
Array (HH.ClassName) -> Array (HH.HTML w i) -> HH.HTML w i
|
||||
columns classes = HH.div [ HP.classes (C.columns <> classes) ]
|
||||
|
||||
columns_ :: forall (w :: Type) (i :: Type). Array (HH.HTML w i) -> HH.HTML w i
|
||||
columns_ = columns []
|
||||
|
||||
column :: forall (w :: Type) (i :: Type).
|
||||
Array (HH.ClassName) -> Array (HH.HTML w i) -> HH.HTML w i
|
||||
column classes = HH.div [ HP.classes (C.column <> classes) ]
|
||||
|
||||
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
|
||||
h1 title = HH.h1 [ HP.classes (C.title) ] [ HH.text title ]
|
||||
|
||||
h3 :: forall (w :: Type) (a :: Type). String -> HH.HTML w a
|
||||
h3 title = HH.h1 [ HP.classes (C.title <> C.is5) ] [ HH.text title ]
|
||||
|
||||
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"] ]
|
||||
|
||||
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)) ]
|
||||
|
||||
input_classes :: forall (r :: Row Type) (i :: Type)
|
||||
. Boolean -> HP.IProp ( class :: String | r ) i
|
||||
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" ]
|
||||
|
||||
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" ]
|
||||
, HH.th_ [ HH.text "Domain" ]
|
||||
, HH.th_ [ HH.text "TTL" ]
|
||||
, HH.th_ [ HH.text "Value" ]
|
||||
]
|
||||
]
|
||||
|
||||
mx_table_header :: forall w i. HH.HTML w i
|
||||
mx_table_header
|
||||
= HH.thead_ [ HH.tr_ [ HH.th_ [ HH.text "Domain" ]
|
||||
, HH.th_ [ HH.text "TTL" ]
|
||||
, HH.th_ [ HH.text "Priority" ]
|
||||
, HH.th_ [ HH.text "Value" ]
|
||||
]
|
||||
]
|
||||
|
||||
srv_table_header :: forall w i. HH.HTML w i
|
||||
srv_table_header
|
||||
= HH.thead_ [ HH.tr_ [ HH.th_ [ HH.text "Domain" ]
|
||||
, HH.th_ [ HH.text "TTL" ]
|
||||
, HH.th_ [ HH.text "Priority" ]
|
||||
, HH.th_ [ HH.text "Weight" ]
|
||||
, HH.th_ [ HH.text "Port" ]
|
||||
, HH.th_ [ HH.text "Value" ]
|
||||
]
|
||||
]
|
||||
|
||||
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
|
||||
|
||||
input_email :: forall w i. (String -> i) -> String -> Boolean -> HH.HTML w i
|
||||
input_email action "" validity
|
||||
= HH.input [ HE.onValueInput action, HP.placeholder "email", input_classes validity ]
|
||||
input_email action email validity
|
||||
= HH.input
|
||||
[ HE.onValueInput action
|
||||
, HP.value email
|
||||
, HP.placeholder "email"
|
||||
, input_classes validity
|
||||
]
|
||||
|
||||
box_input_email :: forall w i. (String -> i) -> String -> Boolean -> HH.HTML w i
|
||||
box_input_email action email validity = HH.label [ ]
|
||||
[ HH.label [HP.classes C.label ] [ HH.text "Email" ]
|
||||
, HH.div [HP.classes C.control ] [ input_email action email validity ]
|
||||
]
|
||||
|
||||
|
||||
input_password :: forall w i. (String -> i) -> String -> Boolean -> HH.HTML w i
|
||||
input_password action "" validity
|
||||
= HH.input [ HE.onValueInput action, HP.placeholder "password", input_classes validity ]
|
||||
input_password action password validity
|
||||
= HH.input
|
||||
[ HE.onValueInput action
|
||||
, HP.value password
|
||||
, HP.placeholder "password"
|
||||
, input_classes validity
|
||||
]
|
||||
|
||||
box_input_password :: forall w i. (String -> i) -> String -> Boolean -> HH.HTML w i
|
||||
box_input_password action password validity = HH.label [ ]
|
||||
[ HH.label [HP.classes C.label ] [ HH.text "Password" ]
|
||||
, HH.div [HP.classes C.control ] [ input_password action password validity ]
|
||||
]
|
||||
|
||||
|
||||
-- TODO: right types
|
||||
-- input_domain :: forall a w i
|
||||
-- . (String -> a)
|
||||
-- -> String
|
||||
-- -> Boolean
|
||||
-- -> HH.HTML w i
|
||||
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"
|
||||
, input_classes validity
|
||||
]
|
||||
|
||||
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
|
||||
, HP.prop (PropName "size") 6.0
|
||||
, HP.placeholder "ttl"
|
||||
, 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
|
||||
, HP.prop (PropName "size") 6.0
|
||||
, HP.placeholder "priority"
|
||||
, 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 ]
|
||||
]
|
||||
|
||||
|
||||
input_value :: forall w i. (String -> i) -> String -> Boolean -> HH.HTML w i
|
||||
input_value action value validity
|
||||
= HH.input
|
||||
[ HE.onValueInput action
|
||||
, HP.value value
|
||||
, HP.placeholder "value"
|
||||
, input_classes validity
|
||||
]
|
||||
|
||||
box_input_value :: forall w i. (String -> i) -> String -> Boolean -> HH.HTML w i
|
||||
box_input_value action value validity = HH.label [ ]
|
||||
[ HH.label [HP.classes C.label ] [ HH.text "Value" ]
|
||||
, HH.div [HP.classes C.control ] [ input_value action value validity ]
|
||||
]
|
||||
|
||||
|
||||
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
|
||||
, HP.prop (PropName "size") 6.0
|
||||
, HP.placeholder "weight"
|
||||
, 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
|
||||
, HP.prop (PropName "size") 6.0
|
||||
, HP.placeholder "port"
|
||||
, 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
|
||||
, btn_classes validity
|
||||
] [ HH.text "fix" ]
|
||||
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" ]
|
||||
] [ HH.text "X" ]
|
||||
|
||||
|
||||
btn_add :: forall w i. i -> i -> Boolean -> HH.HTML w i
|
||||
btn_add action1 action2 validity
|
||||
= HH.button
|
||||
[ btn_add_action validity
|
||||
, btn_classes validity
|
||||
] [ HH.text "Add" ]
|
||||
where
|
||||
|
||||
btn_add_action = case _ of
|
||||
true -> HE.onClick \_ -> action1
|
||||
_ -> HE.onClick \_ -> action2
|
||||
|
||||
box :: forall w i. Array (HH.HTML w i) -> HH.HTML w i
|
||||
box = HH.div [HP.classes C.box]
|
|
@ -27,7 +27,6 @@ import Web.Event.Event (Event)
|
|||
import Bulma as Bulma
|
||||
import CSSClasses as C
|
||||
|
||||
import App.Style as S
|
||||
import App.RR
|
||||
|
||||
import App.LogMessage
|
||||
|
@ -585,11 +584,11 @@ render_records records
|
|||
subtitle_txt = "and TXT records"
|
||||
-- subtitle_txt = "Each line is a resource record from your DNS zone."
|
||||
-- <> " You can edit them, then click on the \"fix\" button to synchronize with the server."
|
||||
table_rr = HH.table [] [ S.simple_table_header, table_content ]
|
||||
table_rr = HH.table [] [ Bulma.simple_table_header, table_content ]
|
||||
table_content = HH.tbody_ $ map row records
|
||||
|
||||
row rr = HH.tr_ $
|
||||
[ S.txt_name rr.t
|
||||
[ Bulma.txt_name rr.t
|
||||
, HH.td_ [ Bulma.input_domain ((UpdateLocalSRRForm rr.id) <<< Update_SRR_Domain) rr.domain rr.valid ]
|
||||
, HH.td_ [ Bulma.input_ttl ((UpdateLocalSRRForm rr.id) <<< Update_SRR_TTL ) rr.ttl rr.valid ]
|
||||
, HH.td_ [ Bulma.input_value ((UpdateLocalSRRForm rr.id) <<< Update_SRR_Value) rr.value rr.valid ]
|
||||
|
@ -610,7 +609,7 @@ render_mx_records records
|
|||
]
|
||||
where
|
||||
title_txt = "MX records"
|
||||
table_rr = HH.table [] [ S.mx_table_header, table_content ]
|
||||
table_rr = HH.table [] [ Bulma.mx_table_header, table_content ]
|
||||
table_content = HH.tbody_ $ map row records
|
||||
|
||||
row rr = HH.tr_ $
|
||||
|
@ -634,7 +633,7 @@ render_srv_records records
|
|||
, Bulma.column_ [ Bulma.tile [ table_rr ] ] ]
|
||||
where
|
||||
title_txt = "SRV records"
|
||||
table_rr = HH.table [] [ S.srv_table_header, table_content ]
|
||||
table_rr = HH.table [] [ Bulma.srv_table_header, table_content ]
|
||||
table_content = HH.tbody_ $ map row records
|
||||
|
||||
row rr = HH.tr_ $
|
||||
|
@ -657,7 +656,7 @@ render_new_record rr
|
|||
= Bulma.hdiv [ Bulma.zone_rr_title "New record (NS, A, AAAA, CNAME, TXT)", table ]
|
||||
|
||||
where
|
||||
table = HH.table [] [ S.simple_table_header, render_record_builder ]
|
||||
table = HH.table [] [ Bulma.simple_table_header, render_record_builder ]
|
||||
|
||||
-- render_record_builder :: forall w. HH.HTML w Action
|
||||
render_record_builder
|
||||
|
@ -685,7 +684,7 @@ render_mx_new_record rr
|
|||
= Bulma.hdiv [ Bulma.zone_rr_title "New MX record", table ]
|
||||
|
||||
where
|
||||
table = HH.table [] [ S.mx_table_header, render_record_builder ]
|
||||
table = HH.table [] [ Bulma.mx_table_header, render_record_builder ]
|
||||
|
||||
-- render_record_builder :: forall w. HH.HTML w Action
|
||||
render_record_builder
|
||||
|
@ -702,7 +701,7 @@ render_srv_new_record :: forall (w :: Type). (SRVRR ()) -> HH.HTML w Action
|
|||
render_srv_new_record rr
|
||||
= Bulma.hdiv [ Bulma.zone_rr_title "New SRV record", table ]
|
||||
where
|
||||
table = HH.table [] [ S.srv_table_header, render_record_builder ]
|
||||
table = HH.table [] [ Bulma.srv_table_header, render_record_builder ]
|
||||
|
||||
-- render_record_builder :: forall w. HH.HTML w Action
|
||||
render_record_builder
|
||||
|
@ -737,7 +736,7 @@ render_new_records state
|
|||
render_new_record_column_simple :: forall (w :: Type).
|
||||
(SimpleRR ()) -> HH.HTML w Action
|
||||
render_new_record_column_simple rr
|
||||
= Bulma.column_ $ [ S.box
|
||||
= Bulma.column_ $ [ Bulma.box
|
||||
[ Bulma.zone_rr_title "NS, A, AAAA, CNAME, TXT"
|
||||
, type_selection
|
||||
, Bulma.box_input_domain (UpdateNewSRRForm <<< Update_SRR_Domain) rr.domain rr.valid
|
||||
|
@ -760,7 +759,7 @@ render_new_record_column_simple rr
|
|||
|
||||
render_new_record_colunm_mx :: forall (w :: Type). (MXRR ()) -> HH.HTML w Action
|
||||
render_new_record_colunm_mx rr
|
||||
= Bulma.column_ $ [ S.box
|
||||
= Bulma.column_ $ [ Bulma.box
|
||||
[ Bulma.zone_rr_title "MX"
|
||||
, Bulma.box_input_domain (UpdateNewMXForm <<< Update_MX_Domain) rr.domain rr.valid
|
||||
, Bulma.box_input_ttl (UpdateNewMXForm <<< Update_MX_TTL) rr.ttl rr.valid
|
||||
|
@ -772,7 +771,7 @@ render_new_record_colunm_mx rr
|
|||
|
||||
render_new_record_colunm_srv :: forall (w :: Type). (SRVRR ()) -> HH.HTML w Action
|
||||
render_new_record_colunm_srv rr
|
||||
= Bulma.column_ $ [ S.box
|
||||
= Bulma.column_ $ [ Bulma.box
|
||||
[ Bulma.zone_rr_title "SRV"
|
||||
, Bulma.box_input_domain (UpdateNewSRVForm <<< Update_SRV_Domain) rr.domain rr.valid
|
||||
, Bulma.box_input_ttl (UpdateNewSRVForm <<< Update_SRV_TTL) rr.ttl rr.valid
|
||||
|
|
|
@ -63,41 +63,41 @@ 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
|
||||
|
||||
--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" ]
|
||||
-- , HH.th_ [ HH.text "Domain" ]
|
||||
-- , HH.th_ [ HH.text "TTL" ]
|
||||
-- , HH.th_ [ HH.text "Value" ]
|
||||
-- ]
|
||||
-- ]
|
||||
--
|
||||
--mx_table_header :: forall w i. HH.HTML w i
|
||||
--mx_table_header
|
||||
-- = HH.thead_ [ HH.tr_ [ HH.th_ [ HH.text "Domain" ]
|
||||
-- , HH.th_ [ HH.text "TTL" ]
|
||||
-- , HH.th_ [ HH.text "Priority" ]
|
||||
-- , HH.th_ [ HH.text "Value" ]
|
||||
-- ]
|
||||
-- ]
|
||||
--
|
||||
--srv_table_header :: forall w i. HH.HTML w i
|
||||
--srv_table_header
|
||||
-- = HH.thead_ [ HH.tr_ [ HH.th_ [ HH.text "Domain" ]
|
||||
-- , HH.th_ [ HH.text "TTL" ]
|
||||
-- , HH.th_ [ HH.text "Priority" ]
|
||||
-- , HH.th_ [ HH.text "Weight" ]
|
||||
-- , HH.th_ [ HH.text "Port" ]
|
||||
-- , HH.th_ [ HH.text "Value" ]
|
||||
-- ]
|
||||
-- ]
|
||||
--
|
||||
--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
|
||||
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" ]
|
||||
, HH.th_ [ HH.text "Domain" ]
|
||||
, HH.th_ [ HH.text "TTL" ]
|
||||
, HH.th_ [ HH.text "Value" ]
|
||||
]
|
||||
]
|
||||
|
||||
mx_table_header :: forall w i. HH.HTML w i
|
||||
mx_table_header
|
||||
= HH.thead_ [ HH.tr_ [ HH.th_ [ HH.text "Domain" ]
|
||||
, HH.th_ [ HH.text "TTL" ]
|
||||
, HH.th_ [ HH.text "Priority" ]
|
||||
, HH.th_ [ HH.text "Value" ]
|
||||
]
|
||||
]
|
||||
|
||||
srv_table_header :: forall w i. HH.HTML w i
|
||||
srv_table_header
|
||||
= HH.thead_ [ HH.tr_ [ HH.th_ [ HH.text "Domain" ]
|
||||
, HH.th_ [ HH.text "TTL" ]
|
||||
, HH.th_ [ HH.text "Priority" ]
|
||||
, HH.th_ [ HH.text "Weight" ]
|
||||
, HH.th_ [ HH.text "Port" ]
|
||||
, HH.th_ [ HH.text "Value" ]
|
||||
]
|
||||
]
|
||||
|
||||
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
|
||||
|
||||
input_email :: forall w i. (String -> i) -> String -> Boolean -> HH.HTML w i
|
||||
input_email action "" validity
|
||||
|
|
Loading…
Reference in New Issue