@@ -1,4 +1,4 @@
1−module Yoga.Layer.Stories where
1+module Yoga.InlineCode.Stories where
22
33import Prelude hiding (add)
44import Data.Array (intercalate)
@@ -21,39 +21,39 @@ import React.Basic.Hooks as React
2121import Storybook.Decorator.FullScreen (fullScreenDecorator)
2222import Storybook.React (Storybook, add, addDecorator, storiesOf)
2323import Yoga.CompileEditor.Component (compileAndRun)
24−import Yoga.Layer.Component (Action(..))
25−import Yoga.Layer.Component as Layer
24+import Yoga.InlineCode.Component (Action(..))
25+import Yoga.InlineCode.Component as InlineCode
2626import Yoga.Modal.Component as Modal
2727
2828stories ∷ Effect Storybook
2929stories = do
30− storiesOf "Layer" do
30+ storiesOf "InlineCode" do
3131 addDecorator fullScreenDecorator
32− add "The Layer" Layer.makeComponent
32+ add "The InlineCode" InlineCode.makeComponent
3333 [ ( justifill
34− { dispatch: \(_ ∷ Layer.Action) -> ((log "hi") ∷ Effect Unit)
34+ { dispatch: \(_ ∷ InlineCode.Action) -> ((log "hi") ∷ Effect Unit)
3535 }
3636 )
3737 ]
38− add "The Layer with some context" mkWrapper
38+ add "The InlineCode with some context" mkWrapper
3939 [ { inside:
4040 \inlineCode ->
4141 [ R.text "hi!"
42− , element inlineCode (justifill { dispatch: \(_ ∷ Layer.Action) -> (log "Hi") ∷ Effect Unit })
42+ , element inlineCode (justifill { dispatch: \(_ ∷ InlineCode.Action) -> (log "Hi") ∷ Effect Unit })
4343 , R.text "hello again!"
4444 ]
4545 }
4646 ]
47− add "The Layer with some code" mkWrapper
47+ add "The InlineCode with some code" mkWrapper
4848 [ { inside:
4949 \inlineCode ->
5050 [ R.code_ [ R.text "main = logShow \"" ]
51− , element inlineCode (justifill { dispatch: \(_ ∷ Layer.Action) -> (log "Hi") ∷ Effect Unit })
51+ , element inlineCode (justifill { dispatch: \(_ ∷ InlineCode.Action) -> (log "Hi") ∷ Effect Unit })
5252 , R.code_ [ R.text "\"" ]
5353 ]
5454 }
5555 ]
56− add "The Layer with some real code" mkRealWrapper
56+ add "The InlineCode with some real code" mkRealWrapper
5757 [ {} ]
5858
5959codePrefix =
@@ -69,10 +69,10 @@ renderCode c = intercalate [ R.br {} ] (toJSX <$> lines)
6969 toJSX line = [ R.code_ [ R.text line ] ]
7070 lines = split (Pattern "\n") c
7171
72−mkWrapper ∷ Effect (ReactComponent { inside ∷ ReactComponent Layer.Props -> Array JSX })
72+mkWrapper ∷ Effect (ReactComponent { inside ∷ ReactComponent InlineCode.Props -> Array JSX })
7373mkWrapper = do
74− inlineCode <- Layer.makeComponent
75− component "LayerWrapper" \{ inside } -> React.do
74+ inlineCode <- InlineCode.makeComponent
75+ component "InlineCodeWrapper" \{ inside } -> React.do
7676 pure
7777 $ R.div_ (inside inlineCode)
7878
@@ -80,21 +80,21 @@ type State
8080 = Maybe Boolean
8181
8282data RealAction
83− = LayerAction Layer.Action
83+ = InlineCodeAction InlineCode.Action
8484 | CloseModal
8585
8686derive instance eqRealAction ∷ Eq RealAction
8787mkRealWrapper ∷ Effect (ReactComponent {})
8888mkRealWrapper = do
89− inlineCode <- Layer.makeComponent
89+ inlineCode <- InlineCode.makeComponent
9090 modal <- Modal.makeComponent
91− component "LayerWrapper" \{} -> React.do
91+ component "InlineCodeWrapper" \{} -> React.do
9292 state /\ dispatch <- useAffReducer Nothing realReducer
9393 pure
9494 $ R.div_
9595 [ R.h2_ [ R.text "Let's log some 'Magick'" ]
9696 , fragment $ renderCode codePrefix
97− , element inlineCode (justifill { dispatch: dispatch <<< LayerAction, width: String.length "Magick" })
97+ , element inlineCode (justifill { dispatch: dispatch <<< InlineCodeAction, width: String.length "Magick" })
9898 , fragment $ renderCode codeSuffix
9999 , R.br {}
100100 , case state of
@@ -106,7 +106,7 @@ mkRealWrapper = do
106106realReducer ∷ State -> RealAction -> Aff State
107107realReducer state = case _ of
108108 CloseModal -> pure Nothing
109− LayerAction (CompileAndRunCode code) -> do
109+ InlineCodeAction (CompileAndRunCode code) -> do
110110 res <- compileAndRun (M.fetch windowFetch) { code: codePrefix <> code <> codeSuffix }
111111 (pure <<< pure) case res of
112112 Right { stdout }