Repository navigation
Expand file tree
/
Copy pathAbout.elm
More file actions
131 lines (98 loc) · 3.4 KB
/
Copy pathAbout.elm
File metadata and controls
131 lines (98 loc) · 3.4 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
module Pages.About exposing (Model, Msg, Params, page)
import Element
exposing
( Attribute
, DeviceClass(..)
, centerX
, column
, el
, fill
, height
, padding
, paragraph
, px
, spacing
, text
, width
)
import Element.Font as Font
import Element.Region as Region
import Helpers exposing (noCmds)
import Shared exposing (Dimensions)
import Spa.Document exposing (Document)
import Spa.Page as Page exposing (Page)
import Spa.Url exposing (Url)
import Styles
page : Page Params Model Msg
page =
Page.application
{ init = init
, update = update
, subscriptions = subscriptions
, view = view
, save = save
, load = load
}
-- INIT
type alias Params =
()
type alias Model =
Shared.Dimensions
init : Shared.Model -> Url Params -> ( Model, Cmd Msg )
init shared _ =
( shared.dimensions, Cmd.none )
-- UPDATE
type Msg
= NoOp
update : Msg -> Model -> ( Model, Cmd Msg )
update msg model =
case msg of
NoOp ->
model |> noCmds
save : Model -> Shared.Model -> Shared.Model
save _ shared =
shared
load : Shared.Model -> Model -> ( Model, Cmd Msg )
load shared _ =
( shared.dimensions, Cmd.none )
subscriptions : Model -> Sub Msg
subscriptions _ =
Sub.none
-- VIEW
view : Model -> Document Msg
view model =
{ title = "About"
, body =
[ column (style model)
[ el [ Region.heading 1, centerX, Font.bold ] (text "What is this project?")
, paragraph [ width fill, height fill, spacing 5, Font.color Styles.blue ]
[ text "This is example project of the game Quarto, built using the Elm programming language." ]
, el [ Region.heading 1, centerX, Font.bold ] (text "What is Quarto")
, paragraph [ width fill, height fill, spacing 5, Font.color Styles.blue ]
[ text "Quarto is a board game for two players invented by Swiss mathematician Blaise Müller. It is published and copyrighted by Gigamic. "
, text "The game is played on a 4×4 board. "
, text "There are 16 unique pieces to play with, each of which is either; "
, text "tall or short; "
, text "red or blue (or a different pair of colors, e.g. light- or dark-stained wood); "
, text "square or circular; "
, text "and hollow-top or solid-top. "
]
, el [ Region.heading 1, centerX, Font.bold ] (text "How to Play")
, paragraph [ width fill, spacing 5, height fill, Font.color Styles.blue ]
[ text "Players take turns choosing a piece which the other player must then place on the board."
, text "A player wins by placing a piece on the board which forms a horizontal, vertical, or diagonal row of four pieces, all of which have a common attribute (all short, all circular, etc.)."
]
]
]
}
style : Dimensions -> List (Attribute msg)
style dimensions =
let
device =
Element.classifyDevice dimensions
in
case device.class of
Phone ->
[ Font.center, Font.justify, width fill, height fill, padding 15, spacing 15 ]
_ ->
[ Font.center, Font.justify, width (px 580), height fill, centerX, padding 20, spacing 20 ]