No more Bulma module.

This commit is contained in:
Philippe Pittoli 2025-05-06 01:01:49 +02:00
parent ca708999fc
commit a3114ed235
10 changed files with 92 additions and 71 deletions

View file

@ -22,7 +22,6 @@ import Data.Tuple (Tuple(..))
import Web as Web import Web as Web
import Web.Button as Button import Web.Button as Button
import Bulma as Bulma
import Halogen.HTML as HH import Halogen.HTML as HH
import Halogen.HTML.Properties as HP import Halogen.HTML.Properties as HP
import Data.String.CodePoints as CP import Data.String.CodePoints as CP
@ -96,7 +95,7 @@ shared_domains domains_i_share action_enter_domain action_unshare_domain action_
-- | Render all Resource Records. -- | Render all Resource Records.
resource_records :: forall w i. Array ResourceRecord -> (Int -> i) -> (Int -> i) -> (Int -> i) -> HH.HTML w i resource_records :: forall w i. Array ResourceRecord -> (Int -> i) -> (Int -> i) -> (Int -> i) -> HH.HTML w i
resource_records [] _ _ _ = Web.box [Bulma.zone_rr_title "Resource records", Bulma.subtitle "No records for now"] resource_records [] _ _ _ = Web.box [Web.title "Resource records", Web.subtitle "No records for now"]
resource_records records action_create_or_update_rr action_delete_rr action_new_token resource_records records action_create_or_update_rr action_delete_rr action_new_token
= HH.div_ $ = HH.div_ $
(rr_box [bg_color_ro] tag_soa soa_table_header table_content all_soa_rr) (rr_box [bg_color_ro] tag_soa soa_table_header table_content all_soa_rr)

View file

@ -1,57 +0,0 @@
-- | The `Bulma` module is a wrapper around the BULMA css framework.
module Bulma where
import Prelude (map, ($), (<>))
import Halogen.HTML as HH
import Halogen.HTML.Properties as HP
import Halogen.HTML.Events as HE
import CSSClasses as C
import Halogen.HTML.Core (AttrName(..))
-- import Web.Event.Event (type_, Event, EventType(..))
-- import Web.UIEvent.MouseEvent (MouseEvent) -- package web-uievents
outside_link :: forall w i. Array HH.ClassName -> String -> String -> HH.HTML w i
outside_link classes url title = HH.a [ HP.classes classes, HP.target "_blank", HP.href url ] [ 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.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 ]
-- | 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])
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] ]
section_medium :: forall w i. Array (HH.HTML w i) -> HH.HTML w i
section_medium = HH.section [ HP.classes [C.section, C.medium] ]
data_target :: forall r i. String -> HP.IProp r i
data_target = HP.attr (AttrName "data-target")
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
tag_light_info :: forall w i. String -> HH.HTML w i
tag_light_info str = HH.span [HP.classes [C.tag, C.is_info, C.is_light]] [HH.text str]

View file

@ -1,36 +1,41 @@
-- | `Web` module is an abstraction over most HTML-related code in order -- | `Web` module is an abstraction over most HTML-related code in order
-- | to have a consistent style through all the website. -- | to have a consistent style through all the website.
module Web module Web
( module Bulma ( module Web.Basics
, module Web.Basics
, module Web.Box , module Web.Box
, module Web.Button , module Web.Button
, module Web.Checkbox , module Web.Checkbox
, module Web.Column , module Web.Column
, module Web.Data
, module Web.Field , module Web.Field
, module Web.Header , module Web.Header
, module Web.Hero , module Web.Hero
, module Web.Input , module Web.Input
, module Web.Level
, module Web.Modal , module Web.Modal
, module Web.Notification , module Web.Notification
, module Web.Section
, module Web.Tab , module Web.Tab
, module Web.Table , module Web.Table
, module Web.Tag , module Web.Tag
, module Web.Tile
) where ) where
import Web.Basics import Web.Basics (article, article_, code, container, div_content, div_large_content, error_message, explanation, hdiv, hr, p, p_, quote, simple_quote, strong, text, textarea, textarea_, outside_link)
import Web.Box import Web.Box (box, box_, box_with_tag)
import Web.Button (alert_btn, alert_btn_abbr, btn, btn_, btn_abbr, btn_abbr_, btn_add, btn_delete, btn_delete_ro, btn_modify, btn_modify_ro, btn_readonly, btn_ro, btn_save, btn_validation, btn_validation_, cancel_button, delete_btn) import Web.Button (alert_btn, alert_btn_abbr, btn, btn_, btn_abbr, btn_abbr_, btn_add, btn_delete, btn_delete_ro, btn_modify, btn_modify_ro, btn_readonly, btn_ro, btn_save, btn_validation, btn_validation_, cancel_button, delete_btn)
import Web.Checkbox (checkbox) import Web.Checkbox (checkbox)
import Web.Column (column, column_, columns, columns_) import Web.Column (column, column_, columns, columns_)
import Web.Data (data_target)
import Web.Field (btn_labeled, div_field, div_field_, div_field_content, div_field_label, error_field_entry, field_entry, new_domain_field, option, select, selection, selection', selection_field, selection_field', selection_field'', side_text_above_input) import Web.Field (btn_labeled, div_field, div_field_, div_field_content, div_field_label, error_field_entry, field_entry, new_domain_field, option, select, selection, selection', selection_field, selection_field', selection_field'', side_text_above_input)
import Web.Header (h1, h3, h4) import Web.Header (h1, h3, h4, title, subtitle)
import Web.Hero (hero, hero_danger, hero_danger_txt, small_hero) import Web.Hero (hero, hero_danger, hero_danger_txt, small_hero)
import Web.Input (box_input, box_input_, box_password, box_password_, email_input, field_inner, input_classes, input_with_side_text, password_input, password_input_confirmation, password_input_new, render_input, token_input, username_input) import Web.Input (box_input, box_input_, box_password, box_password_, email_input, field_inner, input_classes, input_with_side_text, password_input, password_input_confirmation, password_input_new, render_input, token_input, username_input)
import Web.Level (level)
import Web.Modal (modal, modal_, modal_background, modal_body, modal_card_large, modal_foot, modal_header) import Web.Modal (modal, modal_, modal_background, modal_body, modal_card_large, modal_foot, modal_header)
import Web.Notification (error_box, notification, notification', notification_block', notification_danger, notification_danger', notification_danger_block', notification_primary, notification_primary', notification_success, notification_warning, notification_warning') import Web.Notification (error_box, notification, notification', notification_block', notification_danger, notification_danger', notification_danger_block', notification_primary, notification_primary', notification_success, notification_warning, notification_warning')
import Web.Table (table, table_) import Web.Section (section_medium, section_small)
import Web.Tab (fancy_tabs, tab_entry, tabs) import Web.Tab (fancy_tabs, tab_entry, tabs)
import Web.Tag (tag, tag_ro, tags) import Web.Table (table, table_)
import Web.Tag (tag, tag_ro, tags, tag_light_info)
import Bulma import Web.Tile (tile, tile_, tile_danger, tile_warning)

View file

@ -70,3 +70,6 @@ textarea_ classes placeholder value action
textarea :: forall w i. String -> String -> (String -> i) -> HH.HTML w i textarea :: forall w i. String -> String -> (String -> i) -> HH.HTML w i
textarea placeholder value action = textarea_ [] placeholder value action textarea placeholder value action = textarea_ [] placeholder value action
outside_link :: forall w a. Array HH.ClassName -> String -> String -> HH.HTML w a
outside_link classes url str = HH.a [ HP.classes classes, HP.target "_blank", HP.href url ] [ HH.text str ]

7
src/Web/Data.purs Normal file
View file

@ -0,0 +1,7 @@
module Web.Data where
import Halogen.HTML.Properties as HP
import Halogen.HTML.Core (AttrName(..))
data_target :: forall r i. String -> HP.IProp r i
data_target = HP.attr (AttrName "data-target")

View file

@ -6,10 +6,18 @@ import Halogen.HTML.Properties as HP
import CSSClasses as C import CSSClasses as C
h1 :: forall (w :: Type) (a :: Type). String -> HH.HTML w a h1 :: forall (w :: Type) (a :: Type). String -> HH.HTML w a
h1 title = HH.h1 [ HP.classes [C.title] ] [ HH.text title ] h1 str = HH.h1 [ HP.classes [C.title] ] [ HH.text str ]
h3 :: forall (w :: Type) (a :: Type). String -> HH.HTML w a h3 :: forall (w :: Type) (a :: Type). String -> HH.HTML w a
h3 title = HH.h3 [ HP.classes [C.title] ] [ HH.text title ] h3 str = HH.h3 [ HP.classes [C.title] ] [ HH.text str ]
h4 :: forall (w :: Type) (a :: Type). String -> HH.HTML w a h4 :: forall (w :: Type) (a :: Type). String -> HH.HTML w a
h4 title = HH.h4 [ HP.classes [C.title] ] [ HH.text title ] h4 str = HH.h4 [ HP.classes [C.title] ] [ HH.text str ]
title :: forall w a. String -> HH.HTML w a
title title_str
= HH.h3 [ HP.classes [C.title, C.has_text_light, C.has_background_dark] ]
[ HH.text title_str ]
subtitle :: forall w a. String -> HH.HTML w a
subtitle str = HH.h2 [ HP.classes [C.subtitle, C.is4] ] [ HH.text str ]

20
src/Web/Level.purs Normal file
View file

@ -0,0 +1,20 @@
module Web.Level where
import Prelude (map, ($))
import Halogen.HTML as HH
import Halogen.HTML.Properties as HP
import CSSClasses as C
-- import Web.Event.Event (type_, Event, EventType(..))
-- import Web.UIEvent.MouseEvent (MouseEvent) -- package web-uievents
-- | 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 a. Array (HH.HTML w a) -> Array (HH.HTML w a) -> HH.HTML w a
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])

12
src/Web/Section.purs Normal file
View file

@ -0,0 +1,12 @@
module Web.Section where
import Halogen.HTML as HH
import Halogen.HTML.Properties as HP
import CSSClasses as C
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] ]
section_medium :: forall w i. Array (HH.HTML w i) -> HH.HTML w i
section_medium = HH.section [ HP.classes [C.section, C.medium] ]

View file

@ -13,3 +13,6 @@ tag str = HH.span [HP.classes [C.tag, C.is_dark]] [HH.text str]
tag_ro :: forall w i. String -> HH.HTML w i tag_ro :: forall w i. String -> HH.HTML w i
tag_ro str = HH.span [HP.classes [C.tag, C.is_warning]] [HH.text str] tag_ro str = HH.span [HP.classes [C.tag, C.is_warning]] [HH.text str]
tag_light_info :: forall w i. String -> HH.HTML w i
tag_light_info str = HH.span [HP.classes [C.tag, C.is_info, C.is_light]] [HH.text str]

21
src/Web/Tile.purs Normal file
View file

@ -0,0 +1,21 @@
module Web.Tile where
import Prelude (($), (<>))
import Halogen.HTML as HH
import Halogen.HTML.Properties as HP
import CSSClasses as C
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