blob: 29a97a02bd7e6e007461c63175f9fa2fad934f1b (
plain)
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
65
66
67
68
69
70
71
72
73
74
75
|
module Battle.View.Gauge exposing (get_html)
-- Elm -------------------------------------------------------------------------
import Html
import Html.Attributes
-- Local Module ----------------------------------------------------------------
import Struct.Event
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
get_text_div : (
String ->
List (Html.Attribute Struct.Event.Type) ->
(Html.Html Struct.Event.Type)
)
get_text_div text extra_txt_attr =
(Html.div
(
[(Html.Attributes.class "gauge-text")]
++ extra_txt_attr
)
[
(Html.text text)
]
)
get_bar_div : (
Float ->
List (Html.Attribute Struct.Event.Type) ->
(Html.Html Struct.Event.Type)
)
get_bar_div percent extra_bar_attr =
(Html.div
(
[
(Html.Attributes.style
"width"
((String.fromFloat percent) ++ "%")
),
(Html.Attributes.class
"gauge-bar"
)
]
++
extra_bar_attr
)
[
]
)
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
get_html : (
String ->
Float ->
List (Html.Attribute Struct.Event.Type) ->
List (Html.Attribute Struct.Event.Type) ->
List (Html.Attribute Struct.Event.Type) ->
(Html.Html Struct.Event.Type)
)
get_html text percent extra_div_attr extra_bar_attr extra_txt_attr =
(Html.div
(
[(Html.Attributes.class "gauge")]
++ extra_div_attr
)
[
(get_text_div text extra_txt_attr),
(get_bar_div percent extra_bar_attr)
]
)
|