Skip to content

Commit

Permalink
render comments and associations
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianHicks committed Feb 17, 2020
1 parent d044317 commit 16a162e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
12 changes: 8 additions & 4 deletions src/Attachment.elm
Expand Up @@ -6,17 +6,21 @@ import Html.Events as Events


type Attachment
= Attachment Float
= Attachment Float Int


view : Attachment -> Html msg
view _ =
view (Attachment _ commentId) =
Html.div
[ Attrs.style "width" "15px"
, Attrs.style "height" "15px"
, Attrs.style "border" "1px solid blue"
, Attrs.style "border-radius" "100%"
, Attrs.style "border-top-right-radius" "100%"
, Attrs.style "border-bottom-right-radius" "100%"
, Attrs.style "background-color" "white"
, Attrs.style "cursor" "pointer"
, Attrs.style "display" "flex"
, Attrs.style "align-items" "center"
, Attrs.style "justify-content" "center"
]
[]
[ Html.text (String.fromInt commentId) ]
9 changes: 7 additions & 2 deletions src/Main.elm
Expand Up @@ -88,7 +88,7 @@ findNewAttachmentTopsTask ids =
|> List.map
(\id ->
Dom.getElement ("attachment-" ++ String.fromInt id)
|> Task.map (\{ element } -> Just ( id, (Debug.log "element" element).y ))
|> Task.map (\{ element } -> Just ( id, element.y ))
|> Task.onError (\_ -> Task.succeed Nothing)
)
|> Task.sequence
Expand Down Expand Up @@ -147,7 +147,12 @@ view model =
++ List.map
(\( id, comment ) ->
Html.div
[ Attrs.id ("comment-" ++ String.fromInt id) ]
[ Attrs.id ("comment-" ++ String.fromInt id)

-- position
, Attrs.style "position" "absolute"
, Attrs.style "left" (String.fromInt (horizMargin * 2) ++ "px")
]
[ Comment.view comment ]
)
(Dict.toList model.comments)
Expand Down

0 comments on commit 16a162e

Please sign in to comment.