elm-twitch/src/Views.elm

42 lines
921 B
Elm
Raw Normal View History

2020-10-03 18:44:16 +02:00
module Views exposing (view)
import Browser
2020-10-04 13:15:57 +02:00
import Colors
import Consts
2020-10-03 18:44:16 +02:00
import Core
2020-10-04 20:20:16 +02:00
import Element
2020-10-04 13:15:57 +02:00
import Element.Font as Font
2020-10-04 20:20:16 +02:00
import Views.Desktop as Desktop
2020-10-03 18:44:16 +02:00
2020-10-04 13:15:57 +02:00
view : Core.FullModel -> Browser.Document Core.Msg
2020-10-03 18:44:16 +02:00
view model =
2020-10-04 18:10:26 +02:00
{ title = title model
2020-10-04 15:24:04 +02:00
, body =
2020-10-04 18:10:26 +02:00
[ Element.layout
[ Font.color Colors.blackFont
, Font.size Consts.normalFontSize
, Font.family [ Font.typeface "Cantarell" ]
]
2020-10-04 20:20:16 +02:00
(Desktop.view model)
2020-10-04 15:24:04 +02:00
]
2020-10-03 18:44:16 +02:00
}
2020-10-04 13:15:57 +02:00
2020-10-04 18:10:26 +02:00
title : Core.FullModel -> String
title model =
case model of
2020-10-04 20:20:16 +02:00
Core.Unloaded _ _ _ ->
2020-10-04 18:10:26 +02:00
Consts.url
Core.Loaded m ->
case m.page of
Core.Home ->
Consts.url
Core.Playlist p ->
Consts.url ++ " - " ++ p.name
Core.Video p v ->
Consts.url ++ " - " ++ p.name ++ " - " ++ v.name