/
Loader.purs
44 lines (40 loc) · 1.17 KB
/
Loader.purs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
module Lumi.Styles.Loader where
import Prelude
import Lumi.Components (PropsModifier)
import Lumi.Styles (Style, color, css, merge, str, styleModifier)
import Lumi.Styles.Theme (LumiTheme(..))
import React.Basic.Emotion (nested)
loader :: forall props. PropsModifier props
loader =
styleModifier \theme ->
( merge
[ mkLoader theme { radius: "38px", borderWidth: "5px" }
, spin
]
)
spin :: Style
spin =
css
{ "@keyframes spin":
nested
$ css
{ from: nested $ css { transform: str "rotate(0deg)" }
, to: nested $ css { transform: str "rotate(360deg)" }
}
}
mkLoader :: LumiTheme -> { radius :: String, borderWidth :: String } -> Style
mkLoader (LumiTheme { colors }) { radius, borderWidth } =
css
{ boxSizing: str "border-box"
, content: str "\"\""
, display: str "inline-block"
, height: str radius
, width: str radius
, borderWidth: str borderWidth
, borderStyle: str "solid"
, borderColor: color colors.black1
, borderTopColor: color colors.black4
, borderRadius: str "50%"
, animation: str "spin 1s infinite linear"
, animationName: str "spin"
}