@@ -9,7 +9,7 @@ import Data.String.CodeUnits as String
99import Data.Tuple.Nested ((/\))
1010import Effect (Effect)
1111import Effect.Aff (Aff)
12−import Effect.Class.Console (log)
12+import Effect.Console (log)
1313import Justifill (justifill)
1414import Milkis as M
1515import Milkis.Impl.Window (windowFetch)
@@ -22,7 +22,6 @@ import React.Basic.Hooks as React
2222import Storybook.Decorator.FullScreen (fullScreenDecorator)
2323import Storybook.React (Storybook, add, addDecorator, storiesOf)
2424import Yoga.CompileEditor.Component (compileAndRun)
25−import Yoga.InlineCode.Component (Action(..))
2625import Yoga.InlineCode.Component as InlineCode
2726import Yoga.Modal.Component as Modal
2827
@@ -32,7 +31,7 @@ stories = do
3231 addDecorator fullScreenDecorator
3332 add "The InlineCode" InlineCode.makeComponent
3433 [ ( justifill
35− { dispatch: \(_ ∷ InlineCode.Action) -> ((log "hi") ∷ Effect Unit)
34+ { onSubmit: log
3635 }
3736 )
3837 ]
@@ -40,7 +39,7 @@ stories = do
4039 [ { inside:
4140 \inlineCode ->
4241 [ R.text "hi!"
43− , element inlineCode (justifill { dispatch: \(_ ∷ InlineCode.Action) -> (log "Hi") ∷ Effect Unit })
42+ , element inlineCode (justifill { onSubmit: log })
4443 , R.text "hello again!"
4544 ]
4645 }
@@ -49,7 +48,7 @@ stories = do
4948 [ { inside:
5049 \inlineCode ->
5150 [ R.code_ [ R.text "main = logShow \"" ]
52− , element inlineCode (justifill { dispatch: \(_ ∷ InlineCode.Action) -> (log "Hi") ∷ Effect Unit })
51+ , element inlineCode (justifill { onSubmit: log })
5352 , R.code_ [ R.text "\"" ]
5453 ]
5554 }
@@ -84,7 +83,7 @@ type State
8483 = Maybe Boolean
8584
8685data RealAction
87− = InlineCodeAction InlineCode.Action
86+ = InlineCodeSubmitted String
8887 | CloseModal
8988
9089derive instance eqRealAction ∷ Eq RealAction
@@ -98,7 +97,7 @@ mkRealWrapper = do
9897 $ R.div_
9998 [ R.h2_ [ R.text "Let's log some 'Magick'" ]
10099 , fragment $ renderCode codePrefix
101− , element inlineCode (justifill { dispatch: dispatch <<< InlineCodeAction, width: String.length "Magick" })
100+ , element inlineCode (justifill { onSubmit: dispatch <<< InlineCodeSubmitted, width: String.length "Magick" })
102101 , fragment $ renderCode codeSuffix
103102 , R.br {}
104103 , case state of
@@ -110,7 +109,7 @@ mkRealWrapper = do
110109realReducer ∷ State -> RealAction -> Aff State
111110realReducer state = case _ of
112111 CloseModal -> pure Nothing
113− InlineCodeAction (CompileAndRunCode code) -> do
112+ InlineCodeSubmitted code -> do
114113 res <- compileAndRun (M.fetch windowFetch) { code: codePrefix <> code <> codeSuffix }
115114 (pure <<< pure) case res of
116115 Right { stdout }