@@ -27,35 +27,10 @@ import Data.Tuple.Nested
27
27
import DOM
28
28
import qualified Data.Array.NonEmpty as NEL
29
29
30
- foreign import addStyleSheet " " "
31
- function addStyleSheet (s) {
32
- return function () {
33
- var e = document.createElement('style');
34
- e.appendChild(document.createTextNode(s));
35
- document.head.appendChild(e);
36
- };
37
- }
38
- " " " :: String -> Eff (dom :: DOM ) Unit
39
-
40
- foreign import titleWidth " " "
41
- function titleWidth () {
42
- return document.getElementById('title').offsetWidth;
43
- }
44
- " " " :: Eff (dom :: DOM ) Number
45
-
46
- foreign import titleHeight " " "
47
- function titleHeight () {
48
- return document.getElementById('title').offsetHeight;
49
- }
50
- " " " :: Eff (dom :: DOM ) Number
51
-
52
- foreign import titleStyle " " "
53
- function titleStyle (s) {
54
- return function () {
55
- document.getElementById('title').setAttribute('style', s);
56
- };
57
- }
58
- " " " :: String -> Eff (dom :: DOM ) Unit
30
+ foreign import addStyleSheet :: forall eff . String -> Eff (dom :: DOM | eff ) Unit
31
+ foreign import titleWidth :: forall eff . Eff (dom :: DOM | eff ) Number
32
+ foreign import titleHeight :: forall eff . Eff (dom :: DOM | eff ) Number
33
+ foreign import titleStyle :: forall eff . String -> Eff (dom :: DOM | eff ) Unit
59
34
60
35
blue1 :: Color
61
36
blue1 = rgb 51 136 204
@@ -64,59 +39,59 @@ blue2 :: Color
64
39
blue2 = rgb 238 238 255
65
40
66
41
backgroundGradient :: forall a . Angle a -> CSS
67
- backgroundGradient a = backgroundImage $ linearGradient a (ColorPoint white (pct 0 )) [] (ColorPoint blue2 (pct 100 ))
42
+ backgroundGradient a = backgroundImage $ linearGradient a (ColorPoint white (pct 0.0 )) [] (ColorPoint blue2 (pct 100.0 ))
68
43
69
44
shake :: (Number -> Number ) -> CSS
70
- shake f = transforms [translate (px (f 3 )) nil, rotate (deg (f 2 ))]
45
+ shake f = transforms [translate (px (f 3.0 )) nil, rotate (deg (f 2.0 ))]
71
46
72
47
style :: CSS
73
48
style = do
74
49
fontFace $ do
75
50
fontFaceFamily $ fromString " Lato"
76
- fontWeight $ weight 300
51
+ fontWeight $ weight 300.0
77
52
fontFaceSrc $ FontFaceSrcLocal " Lato Light" NEL .:|
78
53
[ FontFaceSrcLocal " Lato-Light"
79
54
, FontFaceSrcUrl " http://fonts.gstatic.com/s/lato/v11/EsvMC5un3kjyUhB9ZEPPwg.woff2" (Just WOFF2 )
80
55
]
81
56
82
- keyframes " buzz-button" $ tuple2 50 (shake id) NEL .:| [tuple2 100 (shake negate)]
57
+ keyframes " buzz-button" $ tuple2 50.0 (shake id) NEL .:| [tuple2 100.0 (shake negate)]
83
58
84
- query M .screen (NEL .singleton <<< M .maxWidth $ px 768 ) $
59
+ query M .screen (NEL .singleton <<< M .maxWidth $ px 768.0 ) $
85
60
h1 ? do
86
- fontSize (em 2 )
61
+ fontSize (em 2.0 )
87
62
88
- html ? height (pct 100 )
63
+ html ? height (pct 100.0 )
89
64
body ? do
90
65
fontFamily [" Lato" ] (NEL .singleton sansSerif)
91
66
sym padding nil
92
67
sym margin nil
93
- backgroundGradient (deg 0 )
68
+ backgroundGradient (deg 0.0 )
94
69
(h1 ** a) ? do
95
70
display block
96
71
color blue1
97
72
textDecoration noneTextDecoration
98
- fontWeight $ weight 100
73
+ fontWeight $ weight 100.0
99
74
sym padding (em 0.5 )
100
75
h1 ? do
101
- fontSize (em 3 )
76
+ fontSize (em 3.0 )
102
77
position absolute
103
- left (pct 50 )
104
- top (pct 50 )
105
- backgroundGradient (deg 180 )
106
- border solid (px 1 ) blue1
78
+ left (pct 50.0 )
79
+ top (pct 50.0 )
80
+ backgroundGradient (deg 180.0 )
81
+ border solid (px 1.0 ) blue1
107
82
sym borderRadius (em 0.25 )
108
83
(h1 ## hover) ?
109
- animation (fromString " buzz-button" ) (sec 0.15 ) linear (sec 0 ) infinite normalAnimationDirection forwards
84
+ animation (fromString " buzz-button" ) (sec 0.15 ) linear (sec 0.0 ) infinite normalAnimationDirection forwards
110
85
111
86
center :: Number -> Number -> CSS
112
87
center width height = do
113
- marginLeft (px $ -width / 2 )
114
- marginTop (px $ -height / 2 )
88
+ marginLeft (px $ -width / 2.0 )
89
+ marginTop (px $ -height / 2.0 )
90
+
115
91
116
92
main :: Eff (dom :: DOM ) Unit
117
93
main = do
118
94
addStyleSheet <<< fromMaybe " " <<< renderedSheet $ render style
119
-
120
95
width <- titleWidth
121
96
height <- titleHeight
122
97
titleStyle <<< fromMaybe " " <<< renderedInline <<< render $ center width height
0 commit comments