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

6
import Data.Tuple.Nested ((/\))
7
import Effect (Effect)
8 9
import Reactix as R
import Reactix.DOM.HTML as H
10
import Toestand as T
11

12
import Gargantext.Components.Forest.Tree.Node.Action.Search.SearchField (searchField)
13 14
import Gargantext.Components.Forest.Tree.Node.Action.Search.Types -- (Database, SearchQuery(..), defaultSearchQuery, performSearch, Lang(..))
import Gargantext.Components.Lang (Lang)
15
import Gargantext.Prelude (Unit, pure, ($))
16
import Gargantext.Sessions (Session)
17
import Gargantext.Types as GT
18
import Gargantext.Utils.Reactix as R2
19

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

23 24
type Props = ( langs     :: Array Lang
             , 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

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