@@ -61,8 +61,21 @@ mono :: H.Html -> H.Html
61
61
mono h = h ! A. class_ " mono"
62
62
63
63
css :: String
64
- css = " body { font-family: 'Lato', sans-serif } \
65
- \.mono { font-family: 'Ubuntu Mono', monospace; white-space: pre }"
64
+ css = unlines
65
+ [ " body { font-family: 'Lato', sans-serif; color: #404040; margin: 0; }"
66
+ , " .mono { font-family: 'Ubuntu Mono', monospace; white-space: pre }"
67
+ , " .header { margin: 0; background: #202028; box-shadow: 0 0 10px #808080; color: #E0E0E0; }"
68
+ , " .splitter { margin: 0; height: 5px; background: #606068; }"
69
+ , " .center { width: 960px; margin: 0 auto; padding: 20px; }"
70
+ , " a { color: #808080; }"
71
+ , " @media (max-width:1000px) { .center { width: auto; } }"
72
+ , " ul.examples { list-style-type: none; margin-left: 0; padding-left: 0; }"
73
+ , " ul.examples li { float: left; padding-top: 5px; padding-bottom: 5px; margin-right: 2px; }"
74
+ , " ul.examples li a { background: #d0d0d0; color: #606060; padding-top: 3px; padding-bottom: 3px; font-weight: bold; border-radius: 1px; border: 1px solid #c0c0c0; box-shadow: 1px 1px 0 0 #ffffff inset; text-decoration: none; padding-left: 15px; padding-right: 15px; }"
75
+ , " ul.examples li a:hover { background: #e0e0e0; }"
76
+ , " button { background: #d0d0d0; color: #606060; padding-top: 3px; padding-bottom: 3px; font-weight: bold; border-radius: 1px; border: 1px solid #c0c0c0; box-shadow: 1px 1px 0 0 #ffffff inset; padding-left: 15px; padding-right: 15px; cursor: pointer; }"
77
+ , " button:hover { background: #e0e0e0; }"
78
+ ]
66
79
67
80
gaq :: String
68
81
gaq = unlines
@@ -171,35 +184,41 @@ page input res = html $ renderHtml $ do
171
184
H. style $ H. toHtml $ str css
172
185
H. script ! A. type_ " text/javascript" $ preEscapedToHtml gaq
173
186
H. body $ do
174
- H. h1 $ H. toHtml $ str " Try PureScript!"
175
- H. p $ H. toHtml $ str " Type PureScript code below and press 'Compile' to view the compiled Javascript."
176
- H. p $ mconcat [ H. a ! A. href " http://functorial.com/purescript" $ H. toHtml $ str " Documentation"
177
- , H. toHtml $ str " , "
178
- , H. a ! A. href " http://github.com/paf31/purescript" $ H. toHtml $ str " Compiler Source"
179
- , H. toHtml $ str " , "
180
- , H. a ! A. href " http://github.com/paf31/trypurescript" $ H. toHtml $ str " Try PureScript Source" ]
181
- H. h2 $ H. toHtml $ str " Examples"
182
- H. ul $ forM_ examples $ \ (name, (title, _)) -> do
183
- H. li $ H. a ! A. href (fromString $ " /example/" ++ name) $ H. toHtml title
184
- H. h2 $ H. toHtml $ str " PureScript Code"
185
- H. form ! A. action " /compile" ! A. method " POST" $ do
186
- H. textarea ! A. name " code" ! A. rows " 15" ! A. cols " 100" $ maybe mempty (H. toHtml . str) input
187
- H. div $ H. button ! A. type_ " submit" $ H. toHtml $ str " Compile"
188
- case res of
189
- Nothing -> mempty
190
- Just (Response (Left err)) -> do
191
- H. h1 $ H. toHtml $ str " Error!"
192
- mono $ H. p $ H. toHtml $ err
193
- Just (Response (Right (Compiled " " " " ))) -> do
194
- H. h1 $ H. toHtml $ str " Error!"
195
- mono $ H. p $ H. toHtml $ str " Please enter some input"
196
- Just (Response (Right (Compiled js exts))) -> do
197
- when (not . null $ js) $ do
198
- H. h1 $ H. toHtml $ str " Generated Javascript"
199
- mono $ H. p $ H. toHtml js
200
- when (not . null $ exts) $ do
201
- H. h1 $ H. toHtml $ str " Externs"
202
- mono $ H. p $ H. toHtml exts
187
+ H. div ! A. class_ " header" $ do
188
+ H. div ! A. class_ " center" $ do
189
+ H. h1 $ H. toHtml $ str " Try PureScript!"
190
+ H. p $ H. toHtml $ str " Type PureScript code below and press 'Compile' to view the compiled Javascript."
191
+ H. p $ mconcat [ H. a ! A. href " http://functorial.com/purescript" $ H. toHtml $ str " Documentation"
192
+ , H. toHtml $ str " , "
193
+ , H. a ! A. href " http://github.com/paf31/purescript" $ H. toHtml $ str " Compiler Source"
194
+ , H. toHtml $ str " , "
195
+ , H. a ! A. href " http://github.com/paf31/trypurescript" $ H. toHtml $ str " Try PureScript Source" ]
196
+ H. div ! A. class_ " splitter" $ mempty
197
+ H. div ! A. class_ " main" $ do
198
+ H. div ! A. class_ " center" $ do
199
+ H. h2 $ H. toHtml $ str " Examples"
200
+ H. ul ! A. class_ " examples" $ forM_ examples $ \ (name, (title, _)) -> do
201
+ H. li $ H. a ! A. href (fromString $ " /example/" ++ name) $ H. toHtml title
202
+ H. div ! A. style " clear: left;" $ mempty
203
+ H. h2 $ H. toHtml $ str " PureScript Code"
204
+ H. form ! A. action " /compile" ! A. method " POST" $ do
205
+ H. textarea ! A. name " code" ! A. rows " 15" ! A. style " width: 100%" $ maybe mempty (H. toHtml . str) input
206
+ H. div $ H. button ! A. type_ " submit" $ H. toHtml $ str " Compile"
207
+ case res of
208
+ Nothing -> mempty
209
+ Just (Response (Left err)) -> do
210
+ H. h1 $ H. toHtml $ str " Error!"
211
+ mono $ H. p $ H. toHtml $ err
212
+ Just (Response (Right (Compiled " " " " ))) -> do
213
+ H. h1 $ H. toHtml $ str " Error!"
214
+ mono $ H. p $ H. toHtml $ str " Please enter some input"
215
+ Just (Response (Right (Compiled js exts))) -> do
216
+ when (not . null $ js) $ do
217
+ H. h1 $ H. toHtml $ str " Generated Javascript"
218
+ mono $ H. p $ H. toHtml js
219
+ when (not . null $ exts) $ do
220
+ H. h1 $ H. toHtml $ str " Externs"
221
+ mono $ H. p $ H. toHtml exts
203
222
204
223
server :: Int -> IO ()
205
224
server port = scotty port $ do
0 commit comments