Add part4
This commit is contained in:
33
advanced/part4/src/Assets.elm
Normal file
33
advanced/part4/src/Assets.elm
Normal file
@@ -0,0 +1,33 @@
|
||||
module Assets exposing (error, src)
|
||||
|
||||
{-| Assets, such as images, videos, and audio. (We only have images for now.)
|
||||
|
||||
We should never expose asset URLs directly; this module should be in charge of
|
||||
all of them. One source of truth!
|
||||
|
||||
-}
|
||||
|
||||
import Html exposing (Attribute, Html)
|
||||
import Html.Attributes as Attr
|
||||
|
||||
|
||||
type Image
|
||||
= Image String
|
||||
|
||||
|
||||
|
||||
-- IMAGES
|
||||
|
||||
|
||||
error : Image
|
||||
error =
|
||||
Image "/assets/images/error.jpg"
|
||||
|
||||
|
||||
|
||||
-- USING IMAGES
|
||||
|
||||
|
||||
src : Image -> Attribute msg
|
||||
src (Image url) =
|
||||
Attr.src url
|
||||
Reference in New Issue
Block a user