File tree Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ module Lumi.Components2.Examples.Box where
2
2
3
3
import Prelude
4
4
import Color.Scheme.MaterialDesign (blue , green , red )
5
- import Lumi.Components (lumiElement )
5
+ import Lumi.Components (lumiElement , ($$$) )
6
6
import Lumi.Components.Example (example )
7
7
import Lumi.Components.Spacing (Space (..), vspace )
8
8
import Lumi.Components.Text (h2_ , p_ )
@@ -40,22 +40,22 @@ docs =
40
40
, vspace S24
41
41
, h2_ " Defaults"
42
42
, example $ lumiElement box
43
- $ _ { content = exampleContent }
43
+ $$$ exampleContent
44
44
, h2_ " Row"
45
45
, example $ lumiElement box
46
46
$ _row
47
- $ _ { content = exampleContent }
47
+ $$$ exampleContent
48
48
, h2_ " Align/justify"
49
49
, example $ lumiElement box
50
50
$ _row
51
51
$ _alignSelf Stretch -- only necessary because `example` isn't a Box
52
52
$ _justify End
53
- $ _ { content = exampleContent }
53
+ $$$ exampleContent
54
54
, h2_ " Space evenly"
55
55
, example $ lumiElement box
56
56
$ _row
57
57
$ _alignSelf Stretch -- only necessary because `example` isn't a Box
58
58
$ _justify SpaceEvenly
59
- $ _ { content = exampleContent }
59
+ $$$ exampleContent
60
60
]
61
61
}
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ module Lumi.Components
6
6
, lumiComponent
7
7
, lumiComponentFromHook
8
8
, lumiElement
9
+ , withContent , ($$$)
9
10
) where
10
11
11
12
import Prelude
@@ -76,6 +77,19 @@ lumiComponentFromHook name defaults propsToHook = do
76
77
, className: lumiComponentClassName name
77
78
}
78
79
80
+ -- | A convenient alias for setting the `content` property of a Lumi component
81
+ -- | if it exists.
82
+ infixr 0 withContent as $$$
83
+
84
+ withContent ::
85
+ forall props content r .
86
+ ((LumiProps (content :: content | props ) -> LumiProps (content :: content | props )) -> r ) ->
87
+ content ->
88
+ r
89
+ withContent m content = m _{ content = content }
90
+
91
+ -- # Internal
92
+
79
93
lumiComponentClassName :: String -> String
80
94
lumiComponentClassName name = " lumi-component lumi-" <> toLower name
81
95
You can’t perform that action at this time.
0 commit comments