Skip to content

Commit a87b065

Browse files
authored
Slat interactive background-color (#130)
* SlatInteractionType * primary4 * remove SlatInteractionType and add _interactiveBackground * cleanup imports
1 parent 2f93321 commit a87b065

File tree

2 files changed

+45
-2
lines changed

2 files changed

+45
-2
lines changed

docs/Examples2/Slat.example.purs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,18 @@ docs =
6363
, href: Nothing
6464
}
6565
$ _ { content = exampleSlatContent }
66+
, h2_ "square (default), spaced list, interactive (background color), min-width content"
67+
, example
68+
$ fragment
69+
$ replicate 3
70+
$ lumiElement Slat.slat
71+
$ Slat._listSpaced
72+
$ Slat._interactiveBackground
73+
{ onClick: window >>= alert "click!"
74+
, tabIndex: 1
75+
, href: Nothing
76+
}
77+
$ _ { content = exampleSlatContent }
6678
, h2_ "round, spaced list, non-interactive, min-width 500px"
6779
, example
6880
$ fragment
@@ -86,6 +98,20 @@ docs =
8698
$ Slat._listCompact
8799
$ slatExWidth
88100
$ _ { content = exampleSlatContent }
101+
, h2_ "top/bottom, compact list, interactive (background color), min-width 500px"
102+
, example
103+
$ fragment
104+
$ replicate 9
105+
$ lumiElement Slat.slat
106+
$ Slat._interactiveBackground
107+
{ onClick: window >>= alert "click!"
108+
, tabIndex: 1
109+
, href: Nothing
110+
}
111+
$ Slat._topBottom
112+
$ Slat._listCompact
113+
$ slatExWidth
114+
$ _ { content = exampleSlatContent }
89115
]
90116

91117
slatExWidth :: forall props. PropsModifier props

src/Lumi/Components2/Slat.purs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module Lumi.Components2.Slat
33
, SlatInteraction
44
, slat
55
, _interactive
6+
, _interactiveBackground
67
, module Styles.Slat
78
) where
89

@@ -12,10 +13,10 @@ import Data.Newtype (un)
1213
import Effect (Effect)
1314
import Effect.Unsafe (unsafePerformEffect)
1415
import Lumi.Components (LumiComponent, PropsModifier, lumiComponent, propsModifier)
15-
import Lumi.Styles (styleModifier_, toCSS)
16+
import Lumi.Styles (styleModifier, styleModifier_, toCSS)
1617
import Lumi.Styles.Slat (_interactive, slat) as Styles.Slat.Hidden
1718
import Lumi.Styles.Slat hiding (_interactive, slat) as Styles.Slat
18-
import Lumi.Styles.Theme (useTheme)
19+
import Lumi.Styles.Theme (LumiTheme(..), useTheme)
1920
import React.Basic.DOM as R
2021
import React.Basic.DOM.Events (capture_)
2122
import React.Basic.Emotion as E
@@ -83,3 +84,19 @@ _interactive interaction =
8384
_
8485
{ interaction = Just interaction
8586
}
87+
88+
_interactiveBackground :: SlatInteraction -> PropsModifier SlatProps
89+
_interactiveBackground interaction =
90+
propsModifier
91+
_
92+
{ interaction = Just interaction
93+
}
94+
>>> styleModifier \(LumiTheme theme) ->
95+
E.css
96+
{ "&:hover":
97+
E.nested
98+
$ E.css
99+
{ backgroundColor: E.color theme.colors.primary4
100+
, borderColor: E.color theme.colors.black4
101+
}
102+
}

0 commit comments

Comments
 (0)