Skip to content

Commit

Permalink
Only render Link-content when visuals exist
Browse files Browse the repository at this point in the history
  • Loading branch information
jonrohan committed Dec 4, 2024
1 parent 23dd4fa commit 004cb2a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
16 changes: 10 additions & 6 deletions app/components/primer/beta/link.html.erb
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
<%= render Primer::ConditionalWrapper.new(condition: tooltip?, trim: true, tag: :span, position: :relative) do %>
<%= render(Primer::BaseComponent.new(trim: true, **@system_arguments)) do %>
<%= render(Primer::BaseComponent.new(tag: :span, classes: "Link-content", trim: true)) do %>
<% if leading_visual %>
<%= leading_visual %>
<% if leading_visual || trailing_visual %>
<%= render(Primer::BaseComponent.new(tag: :span, classes: "Link-content", trim: true)) do %>
<% if leading_visual %>
<%= leading_visual %>
<% end %>
<%= content %>
<% if trailing_visual %>
<%= trailing_visual %>
<% end %>
<% end %>
<% else %>
<%= content %>
<% if trailing_visual %>
<%= trailing_visual %>
<% end %>
<% end %>
<% end %>
<%= tooltip if tooltip? %>
Expand Down
3 changes: 3 additions & 0 deletions static/classes.json
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,9 @@
"Link--underline": [
"Primer::Beta::Link"
],
"Link-content": [
"Primer::Beta::Link"
],
"Overlay": [
"Primer::Alpha::Dialog",
"Primer::Alpha::Overlay"
Expand Down

0 comments on commit 004cb2a

Please sign in to comment.