Skip to content

Commit ce7a99e

Browse files
committed
Merge pull request #13 from born2defy/SiteFix
Fixed NEL import; Fixed Number/Int issues; Builds Now
2 parents 7dd0bdf + 88fabc9 commit ce7a99e

File tree

2 files changed

+49
-47
lines changed

2 files changed

+49
-47
lines changed

site/Main.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/* global exports */
2+
"use strict";
3+
4+
// module Main
5+
6+
7+
exports.addStyleSheet = function(s){
8+
return function () {
9+
var e = document.createElement('style');
10+
e.appendChild(document.createTextNode(s));
11+
document.head.appendChild(e);
12+
};
13+
}
14+
15+
exports.titleWidth = function(){
16+
return document.getElementById('title').offsetWidth;
17+
}
18+
19+
exports.titleHeight = function(){
20+
return document.getElementById('title').offsetHeight;
21+
}
22+
23+
exports.titleStyle = function(s){
24+
return function () {
25+
document.getElementById('title').setAttribute('style', s);
26+
};
27+
}

site/Main.purs

Lines changed: 22 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -27,35 +27,10 @@ import Data.Tuple.Nested
2727
import DOM
2828
import qualified Data.Array.NonEmpty as NEL
2929

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
5934

6035
blue1 :: Color
6136
blue1 = rgb 51 136 204
@@ -64,59 +39,59 @@ blue2 :: Color
6439
blue2 = rgb 238 238 255
6540

6641
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))
6843

6944
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))]
7146

7247
style :: CSS
7348
style = do
7449
fontFace $ do
7550
fontFaceFamily $ fromString "Lato"
76-
fontWeight $ weight 300
51+
fontWeight $ weight 300.0
7752
fontFaceSrc $ FontFaceSrcLocal "Lato Light" NEL.:|
7853
[ FontFaceSrcLocal "Lato-Light"
7954
, FontFaceSrcUrl "http://fonts.gstatic.com/s/lato/v11/EsvMC5un3kjyUhB9ZEPPwg.woff2" (Just WOFF2)
8055
]
8156

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)]
8358

84-
query M.screen (NEL.singleton <<< M.maxWidth $ px 768) $
59+
query M.screen (NEL.singleton <<< M.maxWidth $ px 768.0) $
8560
h1 ? do
86-
fontSize (em 2)
61+
fontSize (em 2.0)
8762

88-
html ? height (pct 100)
63+
html ? height (pct 100.0)
8964
body ? do
9065
fontFamily ["Lato"] (NEL.singleton sansSerif)
9166
sym padding nil
9267
sym margin nil
93-
backgroundGradient (deg 0)
68+
backgroundGradient (deg 0.0)
9469
(h1 ** a) ? do
9570
display block
9671
color blue1
9772
textDecoration noneTextDecoration
98-
fontWeight $ weight 100
73+
fontWeight $ weight 100.0
9974
sym padding (em 0.5)
10075
h1 ? do
101-
fontSize (em 3)
76+
fontSize (em 3.0)
10277
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
10782
sym borderRadius (em 0.25)
10883
(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
11085

11186
center :: Number -> Number -> CSS
11287
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+
11591

11692
main :: Eff (dom :: DOM) Unit
11793
main = do
11894
addStyleSheet <<< fromMaybe "" <<< renderedSheet $ render style
119-
12095
width <- titleWidth
12196
height <- titleHeight
12297
titleStyle <<< fromMaybe "" <<< renderedInline <<< render $ center width height

0 commit comments

Comments
 (0)