Tiles + titles.

beta
Philippe Pittoli 2023-07-09 14:26:47 +02:00
parent 7f08646fda
commit b178a830cc
3 changed files with 39 additions and 20 deletions

View File

@ -182,11 +182,11 @@ default_domain :: String
default_domain = "netlib.re"
initialState :: Input -> State
initialState _ =
initialState domain =
{ wsUp: true
, active_modal: Nothing
, _current_domain: "hello.example.com"
, _current_domain: domain
, _rr: defaultResourceRecords
, _mxrr: defaultMXResourceRecords
, _srvrr: []
@ -201,7 +201,8 @@ render state
[ case state.wsUp, state.active_modal of
false, _ -> Bulma.p "You are disconnected."
true, Just domain -> modal_rr_delete domain
true, Nothing -> HH.div_ [ nav_bar state._current_domain
true, Nothing -> HH.div_ [ Bulma.h1 state._current_domain
, Bulma.hr
, render_records sorted
, render_mx_records state._mxrr
, render_srv_records state._srvrr
@ -523,13 +524,13 @@ render_records :: forall (w :: Type). Array (SimpleRR ()) -> HH.HTML w Action
render_records []
= S.columns [] [ left_block, right_block ]
where left_block = S.column class_title_size
[ S.h1 "NS, A, AAAA, CNAME"
[ Bulma.zone_rr_title "NS, A, AAAA, CNAME"
, S.subtitle "and TXT records" ]
right_block = S.column_ [ S.subtitle "No records for now" ]
render_records records
= S.columns [] [ S.column class_title_size [S.h1 title_txt, S.subtitle subtitle_txt ]
, S.column_ [ table_rr ]
= S.columns [] [ S.column class_title_size [Bulma.zone_rr_title title_txt, S.subtitle subtitle_txt ]
, S.column_ [ Bulma.tile [ table_rr ] ]
]
where
title_txt = "NS, A, AAAA, CNAME"
@ -553,11 +554,11 @@ render_mx_records :: forall (w :: Type) (l :: Row Type)
. Array (MXRR l) -> HH.HTML w Action
render_mx_records []
= S.columns [] [ left_block, right_block ]
where left_block = S.column class_title_size [ S.h1 "MX records" ]
where left_block = S.column class_title_size [ Bulma.zone_rr_title "MX records" ]
right_block = S.column_ [ S.subtitle "No records for now" ]
render_mx_records records
= S.columns [] [ S.column class_title_size [ S.h1 title_txt ]
, S.column_ [ table_rr ]
= S.columns [] [ S.column class_title_size [ Bulma.zone_rr_title title_txt ]
, S.column_ [ Bulma.tile [ table_rr ] ]
]
where
title_txt = "MX records"
@ -578,11 +579,11 @@ render_srv_records :: forall (w :: Type) (l :: Row Type)
. Array (SRVRR l) -> HH.HTML w Action
render_srv_records []
= S.columns [] [ left_block, right_block ]
where left_block = S.column class_title_size [ S.h1 "SRV records" ]
where left_block = S.column class_title_size [ Bulma.zone_rr_title "SRV records" ]
right_block = S.column_ [ S.subtitle "No records for now" ]
render_srv_records records
= S.columns [] [ S.column class_title_size [ S.h1 title_txt]
, S.column_ [ table_rr ] ]
= S.columns [] [ S.column class_title_size [ Bulma.zone_rr_title title_txt]
, S.column_ [ Bulma.tile [ table_rr ] ] ]
where
title_txt = "SRV records"
table_rr = HH.table [] [ S.srv_table_header, table_content ]
@ -605,7 +606,7 @@ baseRecords = [ "NS", "A", "AAAA", "CNAME", "TXT" ]
render_new_record :: forall (w :: Type). (SimpleRR ()) -> HH.HTML w Action
render_new_record rr
= S.hdiv [ S.h3 "New record (NS, A, AAAA, CNAME, TXT)", table ]
= S.hdiv [ Bulma.zone_rr_title "New record (NS, A, AAAA, CNAME, TXT)", table ]
where
table = HH.table [] [ S.simple_table_header, render_record_builder ]
@ -633,7 +634,7 @@ render_new_record rr
render_mx_new_record :: forall (w :: Type). (MXRR ()) -> HH.HTML w Action
render_mx_new_record rr
= S.hdiv [ S.h3 "New MX record", table ]
= S.hdiv [ Bulma.zone_rr_title "New MX record", table ]
where
table = HH.table [] [ S.mx_table_header, render_record_builder ]
@ -651,7 +652,7 @@ render_mx_new_record rr
render_srv_new_record :: forall (w :: Type). (SRVRR ()) -> HH.HTML w Action
render_srv_new_record rr
= S.hdiv [ S.h3 "New SRV record", table ]
= S.hdiv [ Bulma.zone_rr_title "New SRV record", table ]
where
table = HH.table [] [ S.srv_table_header, render_record_builder ]
@ -673,7 +674,8 @@ render_srv_new_record rr
render_new_records :: forall (w :: Type). State -> HH.HTML w Action
render_new_records state
= S.hdiv
[ S.h1 "Adding new records"
[ Bulma.h1 "Adding new records"
, Bulma.hr
, S.columns []
[ render_new_record_column_simple state._current_entry
, render_new_record_colunm_mx state._current_entry_mx
@ -688,7 +690,7 @@ render_new_record_column_simple :: forall (w :: Type).
(SimpleRR ()) -> HH.HTML w Action
render_new_record_column_simple rr
= S.column_ $ [ S.box
[ S.h3 "NS, A, AAAA, CNAME, TXT"
[ Bulma.zone_rr_title "NS, A, AAAA, CNAME, TXT"
, type_selection
, S.box_input_domain UpdateNewDomainSimple rr.domain rr.valid
, S.box_input_ttl UpdateNewTTLSimple rr.ttl rr.valid
@ -711,7 +713,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
= S.column_ $ [ S.box
[ S.h3 "MX"
[ Bulma.zone_rr_title "MX"
, S.box_input_domain UpdateNewDomainMX rr.domain rr.valid
, S.box_input_ttl UpdateNewTTLMX rr.ttl rr.valid
, S.box_input_priority UpdateNewMXPriority rr.priority rr.valid
@ -723,7 +725,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
= S.column_ $ [ S.box
[ S.h3 "SRV"
[ Bulma.zone_rr_title "SRV"
, S.box_input_domain UpdateNewDomainSRV rr.domain rr.valid
, S.box_input_ttl UpdateNewTTLSRV rr.ttl rr.valid
, S.box_input_priority UpdateNewSRVPriority rr.priority rr.valid

View File

@ -34,7 +34,12 @@ 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 ]
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 ]
--subtitle :: forall (w :: Type) (a :: Type). String -> HH.HTML w a
--subtitle title = HH.h2 [ HP.classes (C.subtitle <> C.is4) ] [ HH.text title ]
@ -419,3 +424,9 @@ modal_domain_delete domain =
, HH.strong_ [ HH.text "irreversible" ]
, HH.text "."
]
hr :: forall w i. HH.HTML w i
hr = HH.hr_
tile :: forall w i. Array (HH.HTML w i) -> HH.HTML w i
tile = HH.div [HP.classes (C.tile <> C.is_primary <> C.box)]

View File

@ -26,6 +26,10 @@ field_label :: Array (HH.ClassName)
field_label = [HH.ClassName "field-label"]
has_addons :: Array (HH.ClassName)
has_addons = [HH.ClassName "has-addons"]
has_background_dark :: Array (HH.ClassName)
has_background_dark = [HH.ClassName "has-background-dark"]
has_text_light :: Array (HH.ClassName)
has_text_light = [HH.ClassName "has-text-light"]
has_dropdown :: Array (HH.ClassName)
has_dropdown = [HH.ClassName "has-dropdown"]
hero :: Array (HH.ClassName)
@ -100,5 +104,7 @@ select :: Array (HH.ClassName)
select = [HH.ClassName "select"]
subtitle :: Array (HH.ClassName)
subtitle = [HH.ClassName "subtitle"]
tile :: Array (HH.ClassName)
tile = [HH.ClassName "tile"]
title :: Array (HH.ClassName)
title = [HH.ClassName "title"]