-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathView.elm
64 lines (57 loc) · 2.16 KB
/
View.elm
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
module View exposing (..)
import Html exposing (h1, text, textarea, div, small, pre, a, button, span)
import Html.Attributes exposing (class, href, target, style)
import Html.Events exposing (onClick)
renderProblemLink day =
a
[ target "_blank"
, href ("http://adventofcode.com/2016/day/" ++ day)
]
[ text ("adventofcode.com/2016/day/" ++ day)
]
renderGithubLink day =
let
dayPadded =
if String.length day == 1 then
"0" ++ day
else
day
in
a
[ target "_blank"
, href ("https://github.com/marcospri/adventofcode2016/tree/master/day" ++ dayPadded ++ ".elm")
]
[ text ("[Github]")
]
renderProblem { problemDay, input, solutionPart1, solutionPart2 } ( solvePart1Msg, solvePart2Msg ) =
div []
[ div [ class "page-header" ]
[ a [ href "index.html" ]
[ span [ class "glyphicon glyphicon-home" ] []
]
, h1 []
[ text ("Solution to day " ++ (toString problemDay) ++ " ")
, small []
[ renderGithubLink (toString problemDay)
, span [] [ text " " ]
, renderProblemLink (toString problemDay)
]
]
]
, div [ class "panel panel-defaul" ]
[ div [ class "panel-heading" ] [ text "Problem input" ]
, div [ class "panel-body" ] [ pre [ style [ ( "max-height", "300px" ) ] ] [ text input ] ]
]
, div [ class "panel panel-defaul" ]
[ div [ class "panel-heading" ]
[ button [ class "btn btn-default", onClick solvePart1Msg ] [ text "Solve part 1" ]
]
, div [ class "panel-body" ] [ pre [] [ text solutionPart1 ] ]
]
, div [ class "panel panel-defaul" ]
[ div [ class "panel-heading" ]
[ button [ class "btn btn-default", onClick solvePart2Msg ] [ text "Solve part 2" ]
]
, div [ class "panel-body" ] [ pre [] [ text solutionPart2 ] ]
]
]