Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ActionBar::Item to accept an argument for the passed in IconButton #2223

Merged
merged 3 commits into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading