Skip to content

Commit 66633a7

Browse files
committed
CSS
1 parent 26ed73b commit 66633a7

File tree

1 file changed

+50
-31
lines changed

1 file changed

+50
-31
lines changed

Main.hs

Lines changed: 50 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,21 @@ mono :: H.Html -> H.Html
6161
mono h = h ! A.class_ "mono"
6262

6363
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+
]
6679

6780
gaq :: String
6881
gaq = unlines
@@ -171,35 +184,41 @@ page input res = html $ renderHtml $ do
171184
H.style $ H.toHtml $ str css
172185
H.script ! A.type_ "text/javascript" $ preEscapedToHtml gaq
173186
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
203222

204223
server :: Int -> IO ()
205224
server port = scotty port $ do

0 commit comments

Comments
 (0)