Skip to content
Permalink
Browse files
render fruit list
  • Loading branch information
maxfarseer committed Feb 16, 2020
1 parent 9847eae commit 74f335b3711943a04c34b5441229f974db0e52fc
Showing 1 changed file with 38 additions and 3 deletions.
@@ -1,7 +1,42 @@
module Main exposing (main)

import Browser
import Html exposing (h1, text)
import Html exposing (Html, div, h1, li, text, ul)



-- переменные (аналог const XXX = ... )


fruits : List String
fruits =
[ "яблоко", "банан", "груша" ]



-- функции для отрисовки


renderItem : String -> Html msg
renderItem fruitName =
li [] [ text fruitName ]


renderFruits : List String -> Html msg
renderFruits data =
let
list =
List.map renderItem data
in
ul [] list



-- главная view функция


main =
h1 [] [ text "Hello, Elm!" ]
div []
[ h1 []
[ text "Сезон фруктов!" ]
, renderFruits fruits
]

0 comments on commit 74f335b

Please sign in to comment.