File tree 5 files changed +38
-0
lines changed
generated-docs/React/Basic
5 files changed +38
-0
lines changed Original file line number Diff line number Diff line change 38
38
div { style: css { padding: "5px" } } [ text "This text is padded." ]
39
39
```
40
40
41
+ #### ` mergeStyles `
42
+
43
+ ``` purescript
44
+ mergeStyles :: Array CSS -> CSS
45
+ ```
46
+
47
+ Merge styles from right to left. Uses ` Object.assign ` .
48
+
49
+ E.g.
50
+
51
+ ```
52
+ style: mergeCSS [ (css { padding: "5px" }), props.style ]
53
+ ```
54
+
41
55
#### ` SharedProps `
42
56
43
57
``` purescript
Original file line number Diff line number Diff line change @@ -84,6 +84,12 @@ input { onChange: handler_ (setState \_ -> { value })
84
84
}
85
85
```
86
86
87
+ #### ` syntheticEvent `
88
+
89
+ ``` purescript
90
+ syntheticEvent :: EventFn SyntheticEvent SyntheticEvent
91
+ ```
92
+
87
93
#### ` merge `
88
94
89
95
``` purescript
Original file line number Diff line number Diff line change
1
+ "use strict" ;
2
+
3
+ exports . mergeStyles = function ( styles ) {
4
+ return Object . assign . apply ( null , [ { } ] . concat ( styles ) ) ;
5
+ } ;
Original file line number Diff line number Diff line change @@ -29,6 +29,15 @@ foreign import data CSS :: Type
29
29
css :: forall css . { | css } -> CSS
30
30
css = unsafeCoerce
31
31
32
+ -- | Merge styles from right to left. Uses `Object.assign`.
33
+ -- |
34
+ -- | E.g.
35
+ -- |
36
+ -- | ```
37
+ -- | style: mergeCSS [ (css { padding: "5px" }), props.style ]
38
+ -- | ```
39
+ foreign import mergeStyles :: Array CSS -> CSS
40
+
32
41
-- | Standard props which are shared by all DOM elements.
33
42
type SharedProps specific =
34
43
-- | `key` is not really a DOM attribute - React intercepts it
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ module React.Basic.Events
5
5
, unsafeEventFn
6
6
, handler
7
7
, handler_
8
+ , syntheticEvent
8
9
, merge
9
10
, class Merge
10
11
, mergeImpl
@@ -72,6 +73,9 @@ handler (EventFn fn) cb = mkEffFn1 $ fn >>> cb
72
73
handler_ :: Eff (react :: ReactFX ) Unit -> EventHandler
73
74
handler_ = mkEffFn1 <<< const
74
75
76
+ syntheticEvent :: EventFn SyntheticEvent SyntheticEvent
77
+ syntheticEvent = id
78
+
75
79
class Merge (rl :: RowList ) fns a r | rl -> fns , rl a -> r where
76
80
mergeImpl :: RLProxy rl -> Record fns -> EventFn a (Record r )
77
81
You can’t perform that action at this time.
0 commit comments