From 16a162e522a70efe1f054127f55955d7228940a3 Mon Sep 17 00:00:00 2001 From: Brian Hicks Date: Mon, 17 Feb 2020 16:59:00 -0600 Subject: [PATCH] render comments and associations --- src/Attachment.elm | 12 ++++++++---- src/Main.elm | 9 +++++++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/Attachment.elm b/src/Attachment.elm index be2f252..0202c03 100644 --- a/src/Attachment.elm +++ b/src/Attachment.elm @@ -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) ] diff --git a/src/Main.elm b/src/Main.elm index d54ba76..b8eef6d 100644 --- a/src/Main.elm +++ b/src/Main.elm @@ -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 @@ -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)