Skip to content

Commit

Permalink
Update IconButton and Button tooltips to be sibling instead of child (#…
Browse files Browse the repository at this point in the history
…1265)

* wrapping the icon_button with a span

* Also wrapping button component

* Create honest-pants-matter.md

* wrong system argument
  • Loading branch information
jonrohan authored Aug 2, 2022
1 parent 4a347b6 commit 61a78c4
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/honest-pants-matter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/view-components": patch
---

Update IconButton and Button tooltips to be sibling instead of child
16 changes: 12 additions & 4 deletions app/components/primer/button_component.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
<%= render Primer::Beta::BaseButton.new(**@system_arguments) do -%>
<%= leading_visual %><%= trimmed_content %><%= trailing_visual %><%= primer_octicon("triangle-down", ml: 2, mr: -1) if @dropdown %>
<%= tooltip %>
<% end -%>
<% if tooltip.present? %>
<%= render Primer::BaseComponent.new(tag: :div, position: :relative, display: :inline_block) do %>
<%= render Primer::Beta::BaseButton.new(**@system_arguments) do -%>
<%= leading_visual %><%= trimmed_content %><%= trailing_visual %><%= primer_octicon("triangle-down", ml: 2, mr: -1) if @dropdown %>
<% end -%>
<%= tooltip %>
<% end -%>
<% else %>
<%= render Primer::Beta::BaseButton.new(**@system_arguments) do -%>
<%= leading_visual %><%= trimmed_content %><%= trailing_visual %><%= primer_octicon("triangle-down", ml: 2, mr: -1) if @dropdown %>
<% end -%>
<% end %>
4 changes: 0 additions & 4 deletions app/components/primer/icon_button.erb

This file was deleted.

6 changes: 6 additions & 0 deletions app/components/primer/icon_button.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<%= render Primer::BaseComponent.new(tag: :div, position: :relative, display: :inline_block) do %>
<%= render Primer::Beta::BaseButton.new(**@system_arguments) do -%>
<%= render Primer::OcticonComponent.new(icon: @icon) %>
<% end -%>
<%= render Primer::Alpha::Tooltip.new(**@tooltip_arguments) %>
<% end %>

0 comments on commit 61a78c4

Please sign in to comment.