Skip to content

Instantly share code, notes, and snippets.

@TheZoq2
Created February 25, 2017 08:45
Show Gist options
  • Select an option

  • Save TheZoq2/cd6ec6408d81816767a8f4bcaa7a183d to your computer and use it in GitHub Desktop.

Select an option

Save TheZoq2/cd6ec6408d81816767a8f4bcaa7a183d to your computer and use it in GitHub Desktop.
tagListListHtml :
TagListList
-> (Int -> msg)
-> (Int -> msg)
-> (Int -> Int -> msg)
-> (Int -> Int -> msg)
-> Html msg
tagListListHtml
tagListList
onRemoveButton
onDisableButton
onTagRemoveButton
onTagTextClick
=
let
foldFunction =
(\id value acc ->
acc ++ [(value, (onTagTextClick id), (onTagRemoveButton id))])
tagLists =
Dict.foldl foldFunction [] tagListList.tagLists
in
ul []
<| List.map (\tag onText onRemove -> tagListHtml tag onText onRemove) tagLists
tagListHtml : TagList -> (Int -> msg) -> (Int -> msg) -> Html msg
tagListHtml list onTextClick onRemoveButton =
Dict.foldl
(\key value acc -> acc ++ [(value, (onTextClick key), (onRemoveButton key))])
[]
list.tags
|> htmlFromListOfTags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment