Skip to content

Commit

Permalink
Remove inherent padding from breadcrumb (#642)
Browse files Browse the repository at this point in the history
* Remove inherent padding from breadcrumb

* Apply tag_options to rendered breadcrumb container
  • Loading branch information
aduth authored Dec 12, 2024
1 parent ec8eeb0 commit 4412efa
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
4 changes: 2 additions & 2 deletions _components/breadcrumb_component.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<nav class="usa-breadcrumb" aria-label="Breadcrumbs,,">
<%= tag.nav(**tag_options, class: css_class, aria: { label: 'Breadcrumbs,,' }) do %>
<ol class="usa-breadcrumb__list">
<%= content %>
</ol>
</nav>
<% end %>
12 changes: 11 additions & 1 deletion _components/breadcrumb_component.rb
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
class BreadcrumbComponent < BaseComponent; end
class BreadcrumbComponent < BaseComponent
attr_reader :tag_options

def initialize(**tag_options)
@tag_options = tag_options
end

def css_class
['usa-breadcrumb', *tag_options[:class]]
end
end
2 changes: 1 addition & 1 deletion _layouts/article.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
{% if page.category %}
{% assign home_url = "/" | prepend: site.baseurl %}
{% assign category_url = page.category | slugify | prepend: "/categories/" | prepend: site.baseurl | append: ".html" %}
{% component breadcrumb %}
{% component breadcrumb class="padding-y-0" %}
{% component breadcrumb_item href=home_url %}Home{% endcomponent %}
{% component breadcrumb_item href=category_url %}{{ page.category }}{% endcomponent %}
{% component breadcrumb_item href=page.url current %}{{ page.title }}{% endcomponent %}
Expand Down

0 comments on commit 4412efa

Please sign in to comment.