@@ -4,7 +4,6 @@ import Prelude hiding (add)
4import Data.Tuple.Nested ((/\))
4import Data.Tuple.Nested ((/\))
5import Debug.Trace (spy)
5import Debug.Trace (spy)
6import Effect (Effect)
6import Effect (Effect)
7−import Effect.Unsafe (unsafePerformEffect)
8import JSS (jssClasses)
7import JSS (jssClasses)
9import Justifill (justifill)
8import Justifill (justifill)
10import React.Basic.DOM (css)
9import React.Basic.DOM (css)
@@ -36,14 +35,14 @@ mkAnimated = do
36 box <- Box.makeComponent
35 box <- Box.makeComponent
37 component "Animated Example" \{} -> React.do
36 component "Animated Example" \{} -> React.do
38 toggled /\ modifyToggled <- useState false
37 toggled /\ modifyToggled <- useState false
39− springStyles /\ set <- useSpring $ const { marginTop: "80px", marginBottom: "80px", opacity: 0.7, transform: "scale3d(" <> if toggled then "0.9, 0.9, 1.0" else "1.0, 2.0, 1.0" <> ")" }
38+ { style, set, stop } <- useSpring $ const { opacity: 0.7, transform: "scale3d(" <> if toggled then "0.9, 0.9, 1.0" else "1.0, 2.0, 1.0" <> ")" }
40 useLayoutEffect toggled do
39 useLayoutEffect toggled do
41− set { marginTop: "80px", marginBottom: "30px", opacity: if toggled then 0.7 else 0.9, transform: "scale3d(" <> if toggled then "0.9, 0.9, 1.0" else "1.0, 2.0, 1.0" <> ")" }
40+ (spy "fuck" set) { opacity: if toggled then 0.7 else 0.9, transform: "scale3d(" <> if toggled then "0.9, 0.9, 1.0" else "1.0, 2.0, 1.0" <> ")" }
42 pure mempty
41 pure mempty
44 $ fragment
43 $ fragment
45 [ animatedDiv
44 [ animatedDiv
46− { style: css springStyles
45+ { style: css style
47 , children: [ jsx box {} [ R.text "Click the button" ] ]
46 , children: [ jsx box {} [ R.text "Click the button" ] ]
49 , R.button { children: [ R.text "Toggle" ], onClick: handler_ (modifyToggled not) }
48 , R.button { children: [ R.text "Toggle" ], onClick: handler_ (modifyToggled not) }
@@ -54,7 +53,7 @@ mkDragAnimated = do
54 box <- Box.makeComponent
53 box <- Box.makeComponent
55 useStyles <- makeStylesJSS $ jssClasses \t -> { div: { width: "200px", height: "200px", background: "hotpink" } }
54 useStyles <- makeStylesJSS $ jssClasses \t -> { div: { width: "200px", height: "200px", background: "hotpink" } }
56 component "Draggable Example" \{} -> React.do
55 component "Draggable Example" \{} -> React.do
57− springStyles /\ set <- useSpring $ const { x: 0.0, y: 0.0 }
56+ { style, set } <- useSpring $ const { x: 0.0, y: 0.0 }
58 classes <- useStyles {}
57 classes <- useStyles {}
59 mkDragProps <-
58 mkDragProps <-
60 useDrag \{ down, movement: mx /\ my } ->
59 useDrag \{ down, movement: mx /\ my } ->
@@ -62,7 +61,7 @@ mkDragAnimated = do
63 $ fragment
62 $ fragment
64 [ animatedDiv
63 [ animatedDiv
65− ( { style: css springStyles
64+ ( { style: css style
66 , className: classes.div
65 , className: classes.div
67 , children: [ jsx box {} [ R.text "Drag me somewhere" ] ]
66 , children: [ jsx box {} [ R.text "Drag me somewhere" ] ]