Commit 2661b15e authored by André Espaze's avatar André Espaze
Browse files

Rendering with Tachyons

parent b6179cacc2fe
......@@ -11,6 +11,7 @@
"elm/html": "1.0.0",
"elm/http": "2.0.0",
"elm/json": "1.1.3",
"justgage/tachyons-elm": "4.1.3",
"rtfeldman/elm-css": "16.0.1"
},
"indirect": {
......
......@@ -3,8 +3,10 @@ module Main exposing (main)
import Browser
import Dict
import Html.Styled exposing (..)
import Html.Styled.Attributes exposing (class)
import Http
import Json.Decode as Decode
import Tachyons.Classes as T
type alias Model =
......@@ -21,6 +23,11 @@ type Msg
= CatalogReceived (Result Http.Error SeriesCatalog)
classes : List String -> Attribute msg
classes xs =
class (String.join " " xs)
update : Msg -> Model -> ( Model, Cmd Msg )
update msg model =
let
......@@ -37,7 +44,23 @@ update msg model =
view : Model -> Html Msg
view model =
ul [] <| List.map (\x -> li [] [ text x ]) model.series
let
ul_class =
classes [ T.list, T.pl0, T.ml0, T.center, T.mw5, T.ba, T.b__light_silver, T.br3 ]
li_class =
classes [ T.ph3, T.pv2, T.bb, T.b__light_silver ]
renderSeries xs =
ul [ ul_class ] <| List.map (\x -> li [ li_class ] [ text x ]) xs
article_class =
classes [ T.mw5, T.mw6_ns, T.center, T.pt4 ]
div_class =
classes [ T.aspect_ratio, T.aspect_ratio__1x1, T.mb4 ]
in
article [ article_class ] [ div [ div_class ] [ renderSeries model.series ] ]
main : Program () Model Msg
......
......@@ -3,6 +3,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel=stylesheet href=https://unpkg.com/tachyons@4.10.0/css/tachyons.min.css/>
</head>
<body>
<!-- Minimal entry as provided by Elm in Action -->
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment