[go: nahoru, domu]

Skip to content

Commit

Permalink
Copy button tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
hojberg committed Aug 29, 2024
1 parent a45ad50 commit 9171719
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
23 changes: 16 additions & 7 deletions src/Code/Workspace/WorkspaceItem.elm
Original file line number Diff line number Diff line change
Expand Up @@ -454,21 +454,30 @@ viewInfoItems namespaceActionMenu ref hash_ rawSource info =
hashInfoItem =
Hash.view hash_

copyCodeToClipboard =
copySourceToClipboard =
case rawSource of
Just s ->
div [ class "copy-code" ]
[ CopyOnClick.view s
(div [ class "button small outlined content-icon" ]
[ Icon.view Icon.clipboard ]
)
(Icon.view Icon.checkmark)
[ Tooltip.tooltip (Tooltip.text "Copy full source")
|> Tooltip.withArrow Tooltip.Middle
|> Tooltip.view
(CopyOnClick.view s
(div [ class "button small outlined content-icon" ]
[ Icon.view Icon.clipboard ]
)
(Icon.view Icon.checkmark)
)
]

Nothing ->
UI.nothing
in
div [ class "workspace-item_info-items" ] [ hashInfoItem, otherNames, namespace, copyCodeToClipboard ]
div [ class "workspace-item_info-items" ]
[ hashInfoItem
, otherNames
, namespace
, copySourceToClipboard
]


viewInfo : NamespaceActionMenu -> Reference -> Hash -> Maybe String -> Info -> Category -> Html Msg
Expand Down
5 changes: 5 additions & 0 deletions src/css/code/workspace-item.css
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@
gap: 0.5rem;
}

.workspace-item .workspace-item_header .copy-code .tooltip-bubble {
margin-top: 0.5rem;
margin-left: -1.25rem;
}

.workspace-item .workspace-item_header .copy-code .copy-on-click .copy-on-click_success {
margin-top: 2px;
}
Expand Down

0 comments on commit 9171719

Please sign in to comment.