Skip to content

Commit

Permalink
Merge pull request #14281 from opf/code-maintenance/51277-allow-provi…
Browse files Browse the repository at this point in the history
…ding-an-id-to-the-list-element-in-primer-border-boxes

[#51277] Use system argument to specify `ul` id in `Primer::Beta::BorderBox`es
  • Loading branch information
HDinger authored Dec 1, 2023
2 parents d31dcd1 + e71f6b6 commit 748125d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 16 deletions.
15 changes: 0 additions & 15 deletions app/components/op_primer/component_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,6 @@ def component_collection(**, &)
render(OpPrimer::ComponentCollectionComponent.new(**), &)
end

# There is currently no available system argument for setting an id on the
# rendered <ul> tag that houses the row slots on Primer::Beta::BorderBox components.
# Setting an id is required to be able to uniquely identify a target for
# TurboStream +insert+ actions and being able to prepend and append to it.
def border_box_with_id(id, **, &)
border_box = Primer::Beta::BorderBox.new(**)

new_list_arguments = border_box.instance_variable_get(:@list_arguments)
.merge(id:)

border_box.instance_variable_set(:@list_arguments, new_list_arguments)

render(border_box, &)
end

def border_box_row(wrapper_arguments, &)
if container
container.with_row(**wrapper_arguments, &)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
data: { 'test-selector': 'op-share-wp-active-list',
controller: 'work-packages--share--bulk-selection',
application_target: 'dynamic' }) do
border_box_with_id(insert_target_modifier_id) do |border_box|
render(Primer::Beta::BorderBox.new(list_id: insert_target_modifier_id)) do |border_box|
border_box.with_header(color: :muted, data: { 'test-selector': 'op-share-wp-header' }) do
grid_layout('op-share-wp-modal-body--header', tag: :div, align_items: :center) do |header_grid|
header_grid.with_area(:counter, tag: :div) do
Expand Down

0 comments on commit 748125d

Please sign in to comment.