Commit d89c75de authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

SearchField: some styling added

parent 5b18d623
...@@ -29,13 +29,14 @@ ...@@ -29,13 +29,14 @@
} }
.search-bar-container { .search-bar-container {
text-align: center; text-align: center;
max-width: 800px;
float: left;
} }
.search-bar-toggle { .search-bar-toggle {
padding: 3px; padding: 2px;
border: 0; border: 0;
} }
.search-field { .search-field {
display: grid; /* display: grid; */
grid-template-columns: auto auto auto; /* grid-template-columns: auto auto auto; */
} }
...@@ -49,7 +49,7 @@ searchFieldComponent = R.memo (R.hooksComponent "SearchField" cpt) hasChanged ...@@ -49,7 +49,7 @@ searchFieldComponent = R.memo (R.hooksComponent "SearchField" cpt) hasChanged
term <- R.useState $ \_ -> pure search.term term <- R.useState $ \_ -> pure search.term
db <- R.useState $ \_ -> pure Nothing db <- R.useState $ \_ -> pure Nothing
pure $ pure $
div { className: "search-field form-row" } div { className: "search-field form-inline" }
[ databaseInput db props.databases [ databaseInput db props.databases
, searchInput term , searchInput term
, submitButton db term props.search , submitButton db term props.search
...@@ -58,17 +58,16 @@ searchFieldComponent = R.memo (R.hooksComponent "SearchField" cpt) hasChanged ...@@ -58,17 +58,16 @@ searchFieldComponent = R.memo (R.hooksComponent "SearchField" cpt) hasChanged
databaseInput :: R.State (Maybe Database) -> Array Database -> R.Element databaseInput :: R.State (Maybe Database) -> Array Database -> R.Element
databaseInput (db /\ setDB) dbs = databaseInput (db /\ setDB) dbs =
div { className: "col-auto" } [ select { className: "database form-control", onChange } (item <$> dbs) ] div { className: "form-group" } [ select { className: "database form-control", onChange } (item <$> dbs) ]
where where
onChange = mkEffectFn1 $ \e -> setDB (readDatabase (e .. "target" .. "value")) onChange = mkEffectFn1 $ \e -> setDB (readDatabase (e .. "target" .. "value"))
item db = option { value: (show db) } [ text (show db) ] item db = option { value: (show db) } [ text (show db) ]
searchInput :: R.State String -> R.Element searchInput :: R.State String -> R.Element
searchInput (term /\ setTerm) = searchInput (term /\ setTerm) =
div { className: "col-auto" } [ input { defaultValue: term div { className: "form-group" } [ input { defaultValue: term
, className: "form-control" , className: "form-control"
, type: "text" , type: "text"
, style: { maxWidth: "110px" }
, onChange , onChange
, placeholder } ] , placeholder } ]
where onChange = mkEffectFn1 $ \e -> setTerm $ e .. "target" .. "value" where onChange = mkEffectFn1 $ \e -> setTerm $ e .. "target" .. "value"
...@@ -76,7 +75,7 @@ searchInput (term /\ setTerm) = ...@@ -76,7 +75,7 @@ searchInput (term /\ setTerm) =
submitButton :: R.State (Maybe Database) -> R.State String -> R.State (Maybe Search) -> R.Element submitButton :: R.State (Maybe Database) -> R.State String -> R.State (Maybe Search) -> R.Element
submitButton (database /\ _) (term /\ _) (_ /\ setSearch) = submitButton (database /\ _) (term /\ _) (_ /\ setSearch) =
div { className: "col-auto" } [ button { className: "btn", onClick: click } [ text "Search" ] ] div { className: "form-group" } [ button { className: "btn", onClick: click } [ text "Search" ] ]
where where
click = mkEffectFn1 $ \_ -> do click = mkEffectFn1 $ \_ -> do
case term of case term of
......
...@@ -76,7 +76,8 @@ layout0 :: Spec AppState {} Action ...@@ -76,7 +76,8 @@ layout0 :: Spec AppState {} Action
-> Spec AppState {} Action -> Spec AppState {} Action
layout0 layout = layout0 layout =
fold fold
[ outerLayout [ searchBar
, outerLayout
, layoutFooter , layoutFooter
] ]
where where
...@@ -124,7 +125,8 @@ layout1 :: Spec AppState {} Action ...@@ -124,7 +125,8 @@ layout1 :: Spec AppState {} Action
-> Spec AppState {} Action -> Spec AppState {} Action
layout1 layout = layout1 layout =
fold fold
[ layout [ searchBar
, layout
-- , outerLayout -- , outerLayout
, layoutFooter , layoutFooter
] ]
......
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