Skip to content

Commit

Permalink
fix: Allow Breadcrumb items to wrap (#2869)
Browse files Browse the repository at this point in the history
Co-authored-by: smockle <smockle@users.noreply.github.com>
  • Loading branch information
smockle and smockle authored May 30, 2024
1 parent bbefd41 commit 18d5f21
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/tiny-penguins-roll.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/view-components': patch
---

fix: Allow breadcrumb items to wrap.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion app/components/primer/beta/breadcrumbs.pcss
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.breadcrumb-item {
display: inline-block;
margin-left: -0.35em;
white-space: nowrap;
list-style: none;

&::after {
Expand Down
12 changes: 12 additions & 0 deletions previews/primer/beta/breadcrumbs_preview.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ def default(number_of_links: 2)
end
end
end

# @label WithBetaTruncate
# @snapshot
def with_beta_truncate
render_with_template
end

# @label WithDeprecatedTruncate
# @snapshot
def with_deprecated_truncate
render_with_template
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<% texts = [
"Breadcrumb Item 1",
"Breadcrumb Item 2 with a really long, long, long name",
"Breadcrumb Item 3 with an extremely long, long, long name"
] %>
<%= render(Primer::Beta::Breadcrumbs.new) do |breadcrumbs| %>
<% texts.each_with_index do |text, i| %>
<% breadcrumbs.with_item(href: "##{i}") do %>
<%= render(Primer::Beta::Truncate.new) do |truncate| %>
<% truncate.with_item(max_width: 135) { text } %>
<% end %>
<% end %>
<% end %>
<% end %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<%# erblint:counter DeprecatedComponentsCounter 1 %>
<% texts = [
"Breadcrumb Item 1",
"Breadcrumb Item 2 with a really long, long, long name",
"Breadcrumb Item 3 with an extremely long, long, long name"
] %>
<%= render(Primer::Beta::Breadcrumbs.new) do |breadcrumbs| %>
<% texts.each_with_index do |text, i| %>
<% breadcrumbs.with_item(href: "##{i}") do %>
<%= render(Primer::Truncate.new(inline: true, max_width: 135)) { text } %>
<% end %>
<% end %>
<% end %>

0 comments on commit 18d5f21

Please sign in to comment.