SearchBar.purs 1.46 KB
Newer Older
1
module Gargantext.Components.Forest.Tree.Node.Action.Search.SearchBar
2 3
  ( Props
  , searchBar
4
  ) where
5

6
import Effect (Effect)
7
import Gargantext.Components.Forest.Tree.Node.Action.Search.SearchField (searchField)
8
import Gargantext.Components.Forest.Tree.Node.Action.Search.Types (Search, allDatabases)
9
import Gargantext.Components.Lang (Lang)
10
import Gargantext.Prelude (Unit, pure, ($))
11
import Gargantext.Sessions (Session)
12
import Gargantext.Types (FrontendError)
13
import Gargantext.Types as GT
14
import Gargantext.Utils.Reactix as R2
15 16 17
import Reactix as R
import Reactix.DOM.HTML as H
import Toestand as T
18

19 20
here :: R2.Here
here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Search.SearchBar"
21

22 23
type Props = ( errors    :: T.Box (Array FrontendError)
             , langs     :: Array Lang
24
             , onSearch  :: GT.AsyncTaskWithType -> Effect Unit
25
             , search    :: T.Box Search
26
             , session   :: Session
27
             )
28

29 30
searchBar :: R2.Component Props
searchBar = R.createElement searchBarCpt
31
searchBarCpt :: R.Component Props
32
searchBarCpt = here.component "searchBar" cpt
33
  where
34
    cpt { errors, langs, onSearch, search, session } _ = do
35
      --onSearchChange session s
36
      pure $ H.div { className: "search-bar m-1" }
37 38 39 40 41 42 43 44
        [ searchField { databases: allDatabases
                      , errors
                      , langs
                      , onSearch
                      , search
                      , session
                      } []
        ]