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
22
33import Prelude
44import Color.Scheme.MaterialDesign (blue , green , red )
5- import Lumi.Components (lumiElement )
5+ import Lumi.Components (lumiElement , ($$$) )
66import Lumi.Components.Example (example )
77import Lumi.Components.Spacing (Space (..), vspace )
88import Lumi.Components.Text (h2_ , p_ )
@@ -40,22 +40,22 @@ docs =
4040 , vspace S24
4141 , h2_ " Defaults"
4242 , example $ lumiElement box
43- $ _ { content = exampleContent }
43+ $$$ exampleContent
4444 , h2_ " Row"
4545 , example $ lumiElement box
4646 $ _row
47- $ _ { content = exampleContent }
47+ $$$ exampleContent
4848 , h2_ " Align/justify"
4949 , example $ lumiElement box
5050 $ _row
5151 $ _alignSelf Stretch -- only necessary because `example` isn't a Box
5252 $ _justify End
53- $ _ { content = exampleContent }
53+ $$$ exampleContent
5454 , h2_ " Space evenly"
5555 , example $ lumiElement box
5656 $ _row
5757 $ _alignSelf Stretch -- only necessary because `example` isn't a Box
5858 $ _justify SpaceEvenly
59- $ _ { content = exampleContent }
59+ $$$ exampleContent
6060 ]
6161 }
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ module Lumi.Components
66 , lumiComponent
77 , lumiComponentFromHook
88 , lumiElement
9+ , withContent , ($$$)
910 ) where
1011
1112import Prelude
@@ -76,6 +77,19 @@ lumiComponentFromHook name defaults propsToHook = do
7677 , className: lumiComponentClassName name
7778 }
7879
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+
7993lumiComponentClassName :: String -> String
8094lumiComponentClassName name = " lumi-component lumi-" <> toLower name
8195
You can’t perform that action at this time.
0 commit comments