Commit e30994ec authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FEAT] remove button

parent 36ba9be3
...@@ -32,8 +32,7 @@ thisModule = "Gargantext.Components.NgramsTable.Components" ...@@ -32,8 +32,7 @@ thisModule = "Gargantext.Components.NgramsTable.Components"
type SearchInputProps = type SearchInputProps =
( ( key :: String -- to prevent refreshing & losing input
key :: String -- to prevent refreshing & losing input
, onSearch :: String -> Effect Unit , onSearch :: String -> Effect Unit
, searchQuery :: String , searchQuery :: String
) )
...@@ -44,19 +43,32 @@ searchInput props = R.createElement searchInputCpt props [] ...@@ -44,19 +43,32 @@ searchInput props = R.createElement searchInputCpt props []
searchInputCpt :: R.Component SearchInputProps searchInputCpt :: R.Component SearchInputProps
searchInputCpt = R.hooksComponentWithModule thisModule "searchInput" cpt searchInputCpt = R.hooksComponentWithModule thisModule "searchInput" cpt
where where
cpt { onSearch, searchQuery } _ = do cpt { onSearch, searchQuery } _ =
pure $ H.div { className: "input-group" } [ pure $ H.div { className: "input-group" }
H.div { className: "input-group-addon" } [ [ searchButton
H.span { className: "fa fa-search" } [] , fieldInput searchQuery
]
where
searchButton =
H.div { className: "input-group-addon" }
[
if searchQuery /= ""
then removeButton
else H.span { className: "fa fa-search" } []
] ]
, H.input { className: "form-control" removeButton =
H.button { className: "btn btn-danger"
, on: {click: \e -> onSearch ""}}
[ H.span {className: "fa fa-times"} []]
fieldInput =
H.input { className: "form-control"
, defaultValue: searchQuery , defaultValue: searchQuery
, name: "search" , name: "search"
, on: { input: onSearch <<< R.unsafeEventValue } , on: { input: onSearch <<< R.unsafeEventValue }
, placeholder: "Search" , placeholder: "Search"
, type: "value" } , type: "value"
] }
type SelectionCheckboxProps = type SelectionCheckboxProps =
( (
......
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