[CSS] add labels to input form

parent 929c1b21
Pipeline #7165 passed with stages
in 20 minutes and 1 second
...@@ -99,44 +99,46 @@ addNodeViewCpt = here.component "addNodeView" cpt ...@@ -99,44 +99,46 @@ addNodeViewCpt = here.component "addNodeView" cpt
T.write_ nt nodeType T.write_ nt nodeType
maybeChoose = maybeChoose =
if length nodeTypes > 1 then if length nodeTypes > 1 then
[ Tools.formChoice Tools.formChoice
{ items: nodeTypes { items: nodeTypes
, box: nodeType , box: nodeType
, callback: \nt -> T.write_ (GT.prettyNodeType nt) nodeName , callback: \nt -> T.write_ (GT.prettyNodeType nt) nodeName
, print: print hasChromeAgent' , print: print hasChromeAgent'
} , label: Just "Node type:"
[] }
] []
else else
[ H.div {} H.div {}
[ H.text $ "Creating a node of type " [ H.text $ "Creating a node of type "
<> show defaultNodeType <> show defaultNodeType
<> " with name:" <> " with name:"
] ]
]
maybeEdit = maybeEdit =
if edit then if edit then
[ inputWithEnterWithKey inputWithEnterWithKey
{ autoFocus: true { autoFocus: true
, className: "form-control" , className: "form-control"
, defaultValue: nodeName' -- (prettyNodeType nt') , defaultValue: nodeName' -- (prettyNodeType nt')
, key: show nodeType' , key: show nodeType'
, onBlur: \val -> T.write_ val nodeName , onBlur: \val -> T.write_ val nodeName
, onEnter: \_ -> launchAff_ $ dispatch action , onEnter: \_ -> launchAff_ $ dispatch action
, onValueChanged: \val -> T.write_ val nodeName , onValueChanged: \val -> T.write_ val nodeName
, placeholder: nodeName' -- (prettyNodeType nt') , placeholder: nodeName' -- (prettyNodeType nt')
, required: false , required: false
, type: "text" , type: "text"
} }
] else H.div {} []
else []
pure $ Tools.panelWithSubmitButton pure $ Tools.panelWithSubmitButton
{ action { action
, dispatch , dispatch
, mError: Nothing , mError: Nothing
} }
(maybeChoose <> maybeEdit) [ R2.row
[ R2.col 6 [ maybeChoose ]
, R2.col 6 [ maybeEdit ]
]
]
-- END Create Node -- END Create Node
......
...@@ -78,6 +78,7 @@ updateDashboardCpt = here.component "updateDashboard" cpt ...@@ -78,6 +78,7 @@ updateDashboardCpt = here.component "updateDashboard" cpt
, box: methodBoard , box: methodBoard
, callback: const $ pure unit , callback: const $ pure unit
, print: show , print: show
, label: Just "Method:"
} }
[] []
] ]
...@@ -134,6 +135,7 @@ updateGraphCpt = here.component "updateGraph" cpt ...@@ -134,6 +135,7 @@ updateGraphCpt = here.component "updateGraph" cpt
, box: methodGraphMetric , box: methodGraphMetric
, callback: const $ pure unit , callback: const $ pure unit
, print: show , print: show
, label: Just "Method:"
} }
[] []
] ]
...@@ -291,6 +293,7 @@ updateCorpusCpt = here.component "updateTexts" cpt ...@@ -291,6 +293,7 @@ updateCorpusCpt = here.component "updateTexts" cpt
, box: methodList , box: methodList
, callback: const $ pure unit , callback: const $ pure unit
, print: show , print: show
, label: Just "Method:"
} }
[] []
] ]
...@@ -319,6 +322,7 @@ updateNodeListCpt = here.component "updateNodeList" cpt ...@@ -319,6 +322,7 @@ updateNodeListCpt = here.component "updateNodeList" cpt
, box: methodList , box: methodList
, callback: const $ pure unit , callback: const $ pure unit
, print: show , print: show
, label: Just "Method:"
} }
[] []
] ]
......
...@@ -175,6 +175,7 @@ uploadFileViewWithLangsCpt = here.component "uploadFileViewWithLangs" cpt ...@@ -175,6 +175,7 @@ uploadFileViewWithLangsCpt = here.component "uploadFileViewWithLangs" cpt
, box: fileType , box: fileType
, callback: const $ T.write_ false isPristine , callback: const $ T.write_ false isPristine
, print: show , print: show
, label: Just "File type:"
} }
[] []
, Tools.formChoiceSafe , Tools.formChoiceSafe
...@@ -185,25 +186,22 @@ uploadFileViewWithLangsCpt = here.component "uploadFileViewWithLangs" cpt ...@@ -185,25 +186,22 @@ uploadFileViewWithLangsCpt = here.component "uploadFileViewWithLangs" cpt
, box: fileFormat , box: fileFormat
, callback: const $ T.write_ false isPristine , callback: const $ T.write_ false isPristine
, print: show , print: show
, label: Just "File format:"
} }
[] []
] ]
] , H.div { className: "col-6 flex-space-around" }
, R2.row
[ H.div { className: "col-6 flex-space-around" }
[ Tools.formChoiceSafe [ Tools.formChoiceSafe
{ items: langs <> [ No_extraction ] { items: langs <> [ No_extraction ]
, box: lang , box: lang
, callback: const $ T.write_ false isPristine , callback: const $ T.write_ false isPristine
, print: show , print: show
, label: Just "Language:"
} }
[] []
, ListSelection.selection { selection, session } []
] ]
] ]
, R2.row
[ H.div { className: "col-6 flex-space-around" }
[ ListSelection.selection { selection, session } [] ]
]
] ]
let let
......
...@@ -252,10 +252,10 @@ inviteInputBoxCpt = here.component "textInputBox" cpt ...@@ -252,10 +252,10 @@ inviteInputBoxCpt = here.component "textInputBox" cpt
type FormChoiceSafeProps item m = type FormChoiceSafeProps item m =
( items :: Array item ( items :: Array item
-- , default :: item
, box :: T.Box item , box :: T.Box item
, callback :: item -> Effect m , callback :: item -> Effect m
, print :: item -> String , print :: item -> String
, label :: Maybe String
) )
-- | Form Choice input -- | Form Choice input
...@@ -274,18 +274,18 @@ formChoiceSafeCpt ...@@ -274,18 +274,18 @@ formChoiceSafeCpt
=> R.Component (FormChoiceSafeProps item m) => R.Component (FormChoiceSafeProps item m)
formChoiceSafeCpt = here.component "formChoiceSafe" cpt formChoiceSafeCpt = here.component "formChoiceSafe" cpt
where where
cpt { items, box, callback, print } _ = do cpt { items, box, callback, print, label } _ = do
pure $ case items of pure $ case items of
[] -> H.div {} [] [] -> H.div {} []
[ n ] -> formButton { item: n, callback, print } [] [ n ] -> formButton { item: n, callback, print } []
_ -> formChoice { items, box, callback, print } [] _ -> formChoice { items, box, callback, print, label } []
type FormChoiceProps item m = type FormChoiceProps item m =
( items :: Array item ( items :: Array item
-- , default :: item
, box :: T.Box item , box :: T.Box item
, callback :: item -> Effect m , callback :: item -> Effect m
, print :: item -> String , print :: item -> String
, label :: Maybe String
) )
-- | List Form -- | List Form
...@@ -303,11 +303,17 @@ formChoiceCpt ...@@ -303,11 +303,17 @@ formChoiceCpt
=> R.Component (FormChoiceProps item m) => R.Component (FormChoiceProps item m)
formChoiceCpt = here.component "formChoice" cpt formChoiceCpt = here.component "formChoice" cpt
where where
cpt { items, callback, box, print } _ = do cpt { items, callback, box, print, label } _ = do
value' <- T.useLive T.unequal box value' <- T.useLive T.unequal box
let
labelCpt = case label of
Nothing -> H.div {} []
Just l -> H.label {} [ H.text l ]
pure $ H.div { className: "form-group" } pure $ H.div { className: "form-group" }
[ R2.select [ labelCpt
, R2.select
{ className: "form-control with-icon-font" { className: "form-control with-icon-font"
, value: show value' , value: show value'
, on: { change } , on: { change }
......
...@@ -32,8 +32,9 @@ selectionCpt = here.component "selection" cpt ...@@ -32,8 +32,9 @@ selectionCpt = here.component "selection" cpt
where where
cpt { selection, session } _ = do cpt { selection, session } _ = do
selection' <- R2.useLive' selection selection' <- R2.useLive' selection
pure $ H.div { className: "list-selection p-1" } pure $ H.div { className: "list-selection form-group" }
[ B.formSelect' [ H.label {} [ H.text "List selection:" ]
, B.formSelect'
{ callback: flip T.write_ selection { callback: flip T.write_ selection
, value: selection' , value: selection'
, list: , list:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment