Created
November 21, 2016 22:11
-
-
Save ChetHarrison/a7da5c289507c849e836d0f25bbdf58d to your computer and use it in GitHub Desktop.
First (failed) attempt at adding a keyed node. I am using elm-mdl so I thought I could wrap their textfield component in a keyed div but that didn't solve the problem.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
introField : Model -> Int -> String -> Html Msg | |
introField model index paragraph = | |
node "div" [] | |
[ ( toString index | |
, Textfield.render Mdl [ 3, 0, index ] model.mdl | |
[ Textfield.label <| | |
"Paragraph " ++ | |
(toString <| index + 1) ++ | |
" of Introduction" | |
, Textfield.floatingLabel | |
, Textfield.textarea | |
, Textfield.rows 6 | |
, Textfield.value paragraph | |
, Textfield.onInput <| NewRecipeIntroUpdateParagraph index | |
] | |
) | |
] | |
introFields : Model -> List (Html Msg) | |
introFields model = | |
let | |
indexedIntroParagraphs = | |
List.indexedMap (,) model.newRecipe.intro | |
--x = log "indexed ps" indexedIntroParagraphs | |
in | |
List.map | |
(\p -> | |
let | |
index = | |
fst p | |
text = | |
snd p | |
in | |
Lists.li [] | |
[ Lists.content [] | |
[ introField model index text | |
, deleteIntroParagraphButton model index | |
] | |
] | |
) | |
indexedIntroParagraphs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment