aboutsummaryrefslogtreecommitdiff
path: root/client/src/Component/Select.hs
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/Component/Select.hs')
-rw-r--r--client/src/Component/Select.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/client/src/Component/Select.hs b/client/src/Component/Select.hs
index 9f671d3..43a8a6e 100644
--- a/client/src/Component/Select.hs
+++ b/client/src/Component/Select.hs
@@ -16,6 +16,7 @@ import qualified Common.Msg as Msg
data (Reflex t) => SelectIn t a b c = SelectIn
{ _selectIn_label :: Text
, _selectIn_initialValue :: a
+ , _selectIn_value :: Event t a
, _selectIn_values :: Dynamic t (Map a Text)
, _selectIn_reset :: Event t b
, _selectIn_isValid :: a -> Bool
@@ -48,11 +49,16 @@ select selectIn = do
let initialValue = _selectIn_initialValue selectIn
+ let setValue = R.leftmost
+ [ const initialValue <$> (_selectIn_reset selectIn)
+ , _selectIn_value selectIn
+ ]
+
value <- R._dropdown_value <$>
R.dropdown
initialValue
(_selectIn_values selectIn)
- (R.def { R._dropdownConfig_setValue = fmap (const initialValue) (_selectIn_reset selectIn) })
+ (R.def { R._dropdownConfig_setValue = setValue })
errorMessage <- R.holdDyn "" $ R.attachWith
(\v _ -> if (_selectIn_isValid selectIn) v then "" else "ERROR!")