Update part2 and part3

This commit is contained in:
Richard Feldman
2018-05-05 05:32:17 -04:00
parent 496ff2ae1a
commit fe3780664f
38 changed files with 897 additions and 69 deletions

View File

@@ -7,12 +7,22 @@ import Data.Article exposing (Article)
import Data.UserPhoto as UserPhoto exposing (UserPhoto)
import Date.Format
import Html exposing (..)
import Html.Attributes exposing (attribute, class, classList, href, id, src)
import Html.Attributes exposing (attribute, class, classList, href, id, placeholder, src)
import Route exposing (Route)
import Views.Article.Favorite as Favorite
import Views.Author
-- VIEWS --
{-| Some pages want to view just the timestamp, not the whole article.
-}
viewTimestamp : Article a -> Html msg
viewTimestamp article =
span [ class "date" ] [ text (formattedTimestamp article) ]
view : (Article a -> msg) -> Article a -> Html msg
view toggleFavorite article =
let
@@ -25,7 +35,7 @@ view toggleFavorite article =
[ img [ UserPhoto.src author.image ] [] ]
, div [ class "info" ]
[ Views.Author.view author.username
, viewTimestamp article
, span [ class "date" ] [ text (formattedTimestamp article) ]
]
, Favorite.button
toggleFavorite
@@ -41,9 +51,8 @@ view toggleFavorite article =
]
viewTimestamp : Article a -> Html msg
viewTimestamp article =
span [ class "date" ] [ text (formattedTimestamp article) ]
-- INTERNAL --
formattedTimestamp : Article a -> String