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

[#60359] Harmonise FeedbackDialog slot naming #219

Merged
merged 4 commits into from
Jan 13, 2025
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
5 changes: 5 additions & 0 deletions .changeset/short-students-type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@openproject/primer-view-components': minor
---

[#60359] Harmonise FeedbackDialog slot naming: renames the `additional_content` slot to `additional_details` to make Feedback Dialog consistent with the newly introduced Danger Confirmation Dialog.
4 changes: 2 additions & 2 deletions app/components/primer/open_project/feedback_dialog.html.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<%= render @dialog do |dialog| %>
<% dialog.with_body do %>
<%= feedback_message %>
<% if additional_content.present? %>
<%= additional_content %>
<% if additional_details.present? %>
<%= additional_details %>
<% end %>
<% end %>
<% dialog.with_footer do %>
Expand Down
6 changes: 3 additions & 3 deletions app/components/primer/open_project/feedback_dialog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ class FeedbackDialog < Primer::Component
Primer::OpenProject::FeedbackMessage.new(icon_arguments: icon_arguments, **system_arguments)
}

# Optional additional_content like a form input or toast.
# Optional additional_details like a form input or toast.
#
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
renders_one :additional_content, lambda { |**system_arguments|
renders_one :additional_details, lambda { |**system_arguments|
deny_tag_argument(**system_arguments)
system_arguments[:tag] = :div
system_arguments[:classes] = class_names(
system_arguments[:classes],
"FeedbackDialog-additionalContent"
"FeedbackDialog-additionalDetails"
)

system_arguments[:display] ||= :flex
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<% end %>
<% if show_additional_details %>
<% dialog.with_additional_details do %>
<%= render(Primer::Alpha::Banner.new) { "Some additional content below" } %>
<%= render(Primer::Alpha::Banner.new) { "Some additional details below" } %>
<% end %>
<% end %>
<% dialog.with_confirmation_check_box_content(check_box_text) %>
Expand Down
12 changes: 6 additions & 6 deletions previews/primer/open_project/feedback_dialog_preview.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ def default
# @param icon_color [Symbol] select [default, muted, subtle, accent, success, attention, severe, danger, open, closed, done, sponsors, on_emphasis, inherit]
# @param loading_state [Boolean] toggle
# @param show_description toggle
# @param show_additional_content toggle
# @param show_additional_details toggle
# @param custom_footer toggle
def playground(icon: :"check-circle", icon_color: :success, loading_state: false, show_description: true, show_additional_content: false, custom_footer: false)
def playground(icon: :"check-circle", icon_color: :success, loading_state: false, show_description: true, show_additional_details: false, custom_footer: false)
render_with_template(locals: { icon: icon,
icon_color: icon_color,
loading_state: loading_state,
show_description: show_description,
show_additional_content: show_additional_content,
show_additional_details: show_additional_details,
custom_footer: custom_footer })
end

# @label With additional content
def additional_content
# @label With additional details
def with_additional_details
render_with_template(locals: {})
end

Expand All @@ -52,7 +52,7 @@ def custom_icon
end

# @label With custom footer
def custom_footer
def with_custom_footer
render_with_template(locals: {})
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<% message.with_heading(tag: :h2).with_content("Awesome!") %>
<% message.with_description { "Great! Everything worked well." } if show_description %>
<% end %>
<% if show_additional_content %>
<% dialog.with_additional_content(display: :inline) do %>
<%= render(Primer::Alpha::Banner.new) { "Some additional content below" } %>
<% if show_additional_details %>
<% dialog.with_additional_details(display: :inline) do %>
<%= render(Primer::Alpha::Banner.new) { "Some additional details below" } %>
<% end %>
<% end %>
<% if custom_footer %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<% dialog.with_feedback_message do |message| %>
<% message.with_heading(tag: :h2).with_content("Action successful") %>
<% end %>
<% dialog.with_additional_content do %>
<% dialog.with_additional_details do %>
<% render(Primer::Beta::Text.new) { "You can render whatever component you want here." } %>
<% end %>
<% end %>
12 changes: 6 additions & 6 deletions static/info_arch.json
Original file line number Diff line number Diff line change
Expand Up @@ -17497,8 +17497,8 @@
]
},
{
"name": "additional_content",
"description": "Optional additional_content like a form input or toast.",
"name": "additional_details",
"description": "Optional additional_details like a form input or toast.",
"parameters": [
{
"name": "system_arguments",
Expand Down Expand Up @@ -17547,8 +17547,8 @@
}
},
{
"preview_path": "primer/open_project/feedback_dialog/additional_content",
"name": "additional_content",
"preview_path": "primer/open_project/feedback_dialog/with_additional_details",
"name": "with_additional_details",
"snapshot": "false",
"skip_rules": {
"wont_fix": [
Expand All @@ -17573,8 +17573,8 @@
}
},
{
"preview_path": "primer/open_project/feedback_dialog/custom_footer",
"name": "custom_footer",
"preview_path": "primer/open_project/feedback_dialog/with_custom_footer",
"name": "with_custom_footer",
"snapshot": "false",
"skip_rules": {
"wont_fix": [
Expand Down
8 changes: 4 additions & 4 deletions static/previews.json
Original file line number Diff line number Diff line change
Expand Up @@ -3680,8 +3680,8 @@
}
},
{
"preview_path": "primer/open_project/feedback_dialog/additional_content",
"name": "additional_content",
"preview_path": "primer/open_project/feedback_dialog/with_additional_details",
"name": "with_additional_details",
"snapshot": "false",
"skip_rules": {
"wont_fix": [
Expand All @@ -3706,8 +3706,8 @@
}
},
{
"preview_path": "primer/open_project/feedback_dialog/custom_footer",
"name": "custom_footer",
"preview_path": "primer/open_project/feedback_dialog/with_custom_footer",
"name": "with_custom_footer",
"snapshot": "false",
"skip_rules": {
"wont_fix": [
Expand Down
6 changes: 3 additions & 3 deletions test/components/primer/open_project/feedback_dialog_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ def test_renders
end
end

def test_renders_additional_content
def test_renders_additional_details
render_inline(Primer::OpenProject::FeedbackDialog.new) do |dialog|
dialog.with_feedback_message do |message|
message.with_heading(tag: :h2) { "Success" }
end
dialog.with_additional_content { "Some additional content" }
dialog.with_additional_details { "Some additional details" }
end

assert_selector("dialog.FeedbackDialog") do
assert_selector(".FeedbackDialog-additionalContent", text: "Some additional content")
assert_selector(".FeedbackDialog-additionalDetails", text: "Some additional details")
end
end

Expand Down
Loading