Created
January 30, 2017 13:57
-
-
Save s9gf4ult/3c39756d4b41bc91a246c3ac31ab45cf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
renderCreditCard :: DispatchCreditCard -> CreditCardForm -> ReactRender () | |
renderCreditCard dispatch ccf = div_ $ do | |
let | |
tf :: Text -> (Text -> CreditCardAction) -> Fold CreditCardForm Text -> ReactRender () | |
tf hint action l = textField_ $ TextField | |
{ _tfValue = fromMaybe "" $ ccf ^? l | |
, _tfHint = Just hint | |
, _tfType = TFTText | |
, _tfOnChange = Just $ dispatch . action | |
} | |
div_ $ do | |
tf "Credit card number" CCANumber ccfNumber | |
tf "Owner name" CCAOwnver ccfOwnver | |
div_ $ do | |
tf "Month" CCAMonth $ ccfMonth . _Just . to show' | |
elemText "/" | |
tf "Year" CCAYear $ ccfYear . _Just . to show' | |
div_ $ do | |
tf "CVV" CCACvv $ ccfCVV . _Just . to show' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment