Update part4
This commit is contained in:
@@ -74,29 +74,17 @@ view model =
|
|||||||
|
|
||||||
{-| TODO add a type annotation to viewTag
|
{-| TODO add a type annotation to viewTag
|
||||||
-}
|
-}
|
||||||
viewTag selectedTag tagName =
|
viewTag selectedTagName tagName =
|
||||||
let
|
let
|
||||||
classname =
|
classname =
|
||||||
{- TODO Change this if-expression to be more useful:
|
if tagName == selectedTagName then
|
||||||
|
|
||||||
if tagName == selectedTag then
|
|
||||||
|
|
||||||
Then change viewTag to take selectedTag as its first argument:
|
|
||||||
|
|
||||||
viewTag selectedTag tagName =
|
|
||||||
-}
|
|
||||||
if tagName == tagName then
|
|
||||||
"tag-pill tag-default"
|
|
||||||
else
|
|
||||||
"tag-pill tag-selected"
|
"tag-pill tag-selected"
|
||||||
|
else
|
||||||
|
"tag-pill tag-default"
|
||||||
in
|
in
|
||||||
button
|
button
|
||||||
[ class classname
|
[ class classname
|
||||||
|
, onClick { operation = "SELECT_TAG", data = tagName }
|
||||||
{- TODO add an onClick handler here which selects the given tag.
|
|
||||||
|
|
||||||
HINT: This will require coordination with the update function!
|
|
||||||
-}
|
|
||||||
]
|
]
|
||||||
[ text tagName ]
|
[ text tagName ]
|
||||||
|
|
||||||
@@ -109,7 +97,6 @@ viewTag selectedTag tagName =
|
|||||||
-}
|
-}
|
||||||
update msg model =
|
update msg model =
|
||||||
if msg.operation == "SELECT_TAG" then
|
if msg.operation == "SELECT_TAG" then
|
||||||
-- TODO Return `model` with the `selectedTag` field set to `msg.data`
|
{ model | selectedTag = msg.data }
|
||||||
model
|
|
||||||
else
|
else
|
||||||
model
|
model
|
||||||
|
|||||||
Reference in New Issue
Block a user