Classes are in CSSClasses, some unused code removed, etc.

This commit is contained in:
Philippe Pittoli 2023-07-10 20:15:22 +02:00
parent b976cd2ebc
commit 252fbac269
4 changed files with 28 additions and 49 deletions

View File

@ -54,7 +54,6 @@ import Halogen.HTML.Properties.ARIA as Aria
-- HTML PropName used with HP.prop
-- import Halogen.HTML.Core (PropName(..))
import Halogen.HTML.Core (AttrName(..))
-- | `App.ZoneInterface` can send messages through websocket interface
-- | connected to dnsmanagerd. See `App.WS`.
@ -180,8 +179,8 @@ initialState domain =
, active_modal: Nothing
, _current_domain: domain
, _srr: defaultResourceRecords
, _mxrr: defaultMXResourceRecords
, _srr: []
, _mxrr: []
, _srvrr: []
, _current_entry: defaultResourceA
, _current_entry_mx: defaultResourceMX
@ -783,41 +782,6 @@ render_new_record_colunm_srv rr
]
]
classes_nav :: Array (HH.ClassName)
classes_nav = class_breadcrumb <> class_centered <> class_succeeds_sep
class_succeeds_sep :: Array (HH.ClassName)
class_succeeds_sep = [HH.ClassName "has-succeeds-separator" ]
class_breadcrumb :: Array (HH.ClassName)
class_breadcrumb = [HH.ClassName "breadcrumb"]
class_centered :: Array (HH.ClassName)
class_centered = [HH.ClassName "is-centered"]
-- TODO: wrong type
--home_icon :: forall r w i. Array (HP.IProp r i) -> HH.HTML w i
--home_icon = HH.span
-- [HP.classes [HH.ClassName "icon is-small"]]
-- [HH.i ([HP.classes [HH.ClassName "fas fa-home"]] <> aria) []]
-- where aria = [Aria.hidden "true"]
aria_current :: forall r i. String -> HP.IProp r i
aria_current = HP.attr (AttrName "aria-current")
nav_bar :: forall w i. String -> HH.HTML w i
nav_bar domain
= HH.nav
[ HP.classes classes_nav
, Aria.label "breadcrumbs"
] [ HH.ul_
[ HH.li_ [ HH.a [HP.href "/"] [ HH.text "Home"] ]
, HH.li []
[ HH.a
[HP.href "/", aria_current "page"]
[HH.text ("Domain: " <> domain)]
]
]
]
-- ACTIONS
-- add a new record and get a new placeholter

View File

@ -7,6 +7,7 @@ import Halogen.HTML as HH
import DOM.HTML.Indexed as DHI
import Halogen.HTML.Properties as HP
import Halogen.HTML.Events as HE
import MissingHTMLProperties as MissingProperties
import CSSClasses as C
@ -18,10 +19,6 @@ 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) ]
--prop_size :: HP.PropName "size"
prop_size :: forall r i. Int -> HP.IProp r i
prop_size = HP.prop (PropName "size")
columns_ :: forall (w :: Type) (i :: Type). Array (HH.HTML w i) -> HH.HTML w i
columns_ = columns []
@ -159,7 +156,7 @@ input_ttl action ttl validity
= HH.input
[ HE.onValueInput action
, HP.value ttl
, prop_size 6
, MissingProperties.size 6
, HP.placeholder "ttl"
, HP.classes $ input_classes validity
]
@ -175,7 +172,7 @@ input_priority action priority validity
= HH.input
[ HE.onValueInput action
, HP.value priority
, prop_size 6
, MissingProperties.size 6
, HP.placeholder "priority"
, HP.classes $ input_classes validity
]
@ -207,7 +204,7 @@ input_weight action weight validity
= HH.input
[ HE.onValueInput action
, HP.value weight
, prop_size 6
, MissingProperties.size 6
, HP.placeholder "weight"
, HP.classes $ input_classes validity
]
@ -224,7 +221,7 @@ input_port action port validity
= HH.input
[ HE.onValueInput action
, HP.value port
, prop_size 6
, MissingProperties.size 6
, HP.placeholder "port"
, HP.classes $ input_classes validity
]
@ -302,7 +299,7 @@ field_inner ispassword title placeholder action value validity cond
, div_field_content $ render_input ispassword placeholder action value validity cond
]
where
div_field = HH.div [ HP.classes (C.field <> C.horizontal) ]
div_field = HH.div [ HP.classes (C.field <> C.is_horizontal) ]
div_field_label
= HH.div [ HP.classes (C.field_label <> C.normal) ]
[HH.label [ HP.classes C.label ] [ HH.text title ]]

View File

@ -8,6 +8,8 @@ button :: Array HH.ClassName
button = [HH.ClassName "button"]
buttons :: Array HH.ClassName
buttons = [HH.ClassName "buttons"]
breadcrumb :: Array HH.ClassName
breadcrumb = [HH.ClassName "breadcrumb"]
column :: Array HH.ClassName
column = [HH.ClassName "column"]
columns :: Array HH.ClassName
@ -30,14 +32,14 @@ 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_succeeds_separator :: Array HH.ClassName
has_succeeds_separator = [HH.ClassName "has-succeeds-separator"]
has_dropdown :: Array HH.ClassName
has_dropdown = [HH.ClassName "has-dropdown"]
hero :: Array HH.ClassName
hero = [HH.ClassName "hero"]
hero_body :: Array HH.ClassName
hero_body = [HH.ClassName "hero-body"]
horizontal :: Array HH.ClassName
horizontal = [HH.ClassName "is-horizontal"]
input :: Array HH.ClassName
input = [HH.ClassName "input"]
is4 :: Array HH.ClassName
@ -46,8 +48,12 @@ is5 :: Array HH.ClassName
is5 = [HH.ClassName "is-5"]
is_active :: Array HH.ClassName
is_active = [HH.ClassName "is-active"]
is_centered :: Array HH.ClassName
is_centered = [HH.ClassName "is-centered"]
is_danger :: Array HH.ClassName
is_danger = [HH.ClassName "is-danger"]
is_horizontal :: Array HH.ClassName
is_horizontal = [HH.ClassName "is-horizontal"]
is_hoverable :: Array HH.ClassName
is_hoverable = [HH.ClassName "is-hoverable"]
is_info :: Array HH.ClassName

View File

@ -0,0 +1,12 @@
-- | `MissingHTMLProperties` provides missing properties.
-- | This shall pretty soon be removed.
module MissingHTMLProperties where
import Halogen.HTML.Properties as HP
import Halogen.HTML.Core (PropName(..),AttrName(..))
aria_current :: forall r i. String -> HP.IProp r i
aria_current = HP.attr (AttrName "aria-current")
size :: forall r i. Int -> HP.IProp (size :: Int | r) i
size = HP.prop (PropName "size")