Skip to content

Commit

Permalink
Update ActionBar::Item to accept an argument for the passed in IconBu…
Browse files Browse the repository at this point in the history
…tton (#2223)
  • Loading branch information
jonrohan authored Aug 30, 2023
1 parent d1ca8b7 commit 00b7d5d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
7 changes: 7 additions & 0 deletions .changeset/sour-parrots-fetch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@primer/view-components': minor
---

Moving the render for the ActionBar::Item from the slot initializer to the call method.

<!-- Changed components: _none_ -->
4 changes: 1 addition & 3 deletions app/components/primer/alpha/action_bar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ class ActionBar < Primer::Component
c.with_leading_visual_icon(icon: icon)
end

render(Item.new) do
render(Primer::Beta::IconButton.new(id: item_id, icon: icon, "aria-label": label, size: @size, scheme: :invisible, **system_arguments))
end
Item.new(Primer::Beta::IconButton.new(id: item_id, icon: icon, "aria-label": label, size: @size, scheme: :invisible, **system_arguments))
},
divider: lambda {
@action_menu.with_divider(hidden: true) if @overflow_menu
Expand Down
5 changes: 3 additions & 2 deletions app/components/primer/alpha/action_bar/item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,19 @@ module Alpha
class ActionBar
# ActionBar::Item is an internal component that wraps the items in a div with the `ActionBar-item` class.
class Item < Primer::Component
def initialize
def initialize(item_content)
@system_arguments = {
tag: :div,
data: {
targets: "action-bar.items"
},
classes: "ActionBar-item"
}
@item_content = item_content
end

def call
render(Primer::BaseComponent.new(**@system_arguments)) { content }
render(Primer::BaseComponent.new(**@system_arguments)) { render(@item_content) }
end
end
end
Expand Down

0 comments on commit 00b7d5d

Please sign in to comment.