Created
June 4, 2020 10:55
-
-
Save Ebmtranceboy/4a0aa9072bc2b5540c07ca8a5cbe97b4 to your computer and use it in GitHub Desktop.
Hello Concur
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
module Main where | |
import Prelude | |
import Effect (Effect) | |
import Concur.Core (Widget) | |
import Concur.React (HTML) | |
import Concur.React.DOM (text, div', button, button') as D | |
import Concur.React.Props as P | |
import Concur.React.Run (runWidgetInDom) | |
import Control.Alt ((<|>)) | |
import Control.MultiAlternative (orr) | |
hello1 :: forall a. Widget HTML a | |
hello1 = D.button' [D.text "Hello Sailor!"] | |
hello2 :: forall a. Widget HTML a | |
hello2 = D.div' | |
[ D.button' [D.text "Ahoy Port!"] | |
, D.button' [D.text "Ahoy Starboard!"] | |
] | |
hello3 :: forall a. Widget HTML a | |
hello3 = D.div' | |
[ D.div' | |
[ D.button' [D.text "Ahoy Port!"] ] | |
, D.div' | |
[ D.button' [D.text "Ahoy Starboard!"] ] | |
] | |
hello4 :: forall a. Widget HTML a | |
hello4 = do | |
void $ D.button [P.onClick] [D.text "Say Hello"] | |
D.text "Hello Sailor!" | |
hello5 :: forall a. Widget HTML a | |
hello5 = do | |
void $ D.button [P.onClick] [D.text "Say Hello"] | |
D.button' [D.text "Hello Sailor!"] | |
hello6 :: forall a. Widget HTML a | |
hello6 = do | |
greeting <- D.div' | |
[ "Hello" <$ D.button [P.onClick] [D.text "Say Hello"] | |
, "Namaste" <$ D.button [P.onClick] [D.text "Say Namaste"] | |
] | |
D.text (greeting <> " Sailor!") | |
hello7 :: forall a. Widget HTML a | |
hello7 = | |
D.button' [D.text "Ahoy Port!"] | |
<|> | |
D.button' [D.text "Ahoy Starboard!"] | |
hello8 :: forall a. Widget HTML a | |
hello8 = orr | |
[ D.button' [D.text "Ahoy Port!"] | |
, D.button' [D.text "Ahoy Starboard!"] | |
, D.button' [D.text "One more button!"] | |
] | |
main :: Effect Unit | |
main = do | |
runWidgetInDom "main" hello8 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment