Skip to content

Commit

Permalink
Reverts banner text styling to handle in future work, renames param t…
Browse files Browse the repository at this point in the history
…o be more closer to Banner params.
  • Loading branch information
jamieshark committed Sep 13, 2024
1 parent 27a1867 commit dcf48df
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 17 deletions.
4 changes: 2 additions & 2 deletions app/components/primer/alpha/select_panel.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
<% if show_filter? %>
<% header.with_filter do %>
<div data-target="select-panel.bannerErrorElement" hidden>
<%= render Primer::Alpha::Banner.new(classes: "SelectPanel-banner", scheme: @banner_variant, mb: 2) do %>
<%= render Primer::Alpha::Banner.new(classes: scheme: @banner_scheme, mb: 2) do %>
<% if error_content? %>
<%= error_content %>
<% else %>
<h2 class="f6 text-normal <%= @banner_variant == :warning ? "fgColor-attention" : "fgColor-danger" %>">Sorry, something went wrong.</h2>
<h2 class="f6 text-normal">Sorry, something went wrong.</h2>
<% end %>
<% end %>
</div>
Expand Down
4 changes: 0 additions & 4 deletions app/components/primer/alpha/select_panel.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,3 @@
.SelectPanel-emptyPanel {
min-height: min(var(--overlay-height) - 10rem, 100vh - 2rem);
}

.SelectPanel-banner .Banner-message {
padding: 0
}
16 changes: 8 additions & 8 deletions app/components/primer/alpha/select_panel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,9 @@ def with_avatar_item(**system_arguments)
:none,
].freeze

DEFAULT_BANNER_VARIANT = :danger
BANNER_VARIANT_OPTIONS = [
DEFAULT_BANNER_VARIANT,
DEFAULT_BANNER_SCHEME = :danger
BANNER_SCHEME_OPTIONS = [
DEFAULT_BANNER_SCHEME,
:warning
].freeze

Expand All @@ -337,10 +337,10 @@ def with_avatar_item(**system_arguments)
# @return [Symbol]
attr_reader :select_variant

# <%= one_of(Primer::Alpha::SelectPanel::BANNER_VARIANT_OPTIONS) %>
# <%= one_of(Primer::Alpha::SelectPanel::BANNER_SCHEME_OPTIONS) %>
#
# @return [Symbol]
attr_reader :banner_variant
attr_reader :banner_scheme

# <%= one_of(Primer::Alpha::SelectPanel::FETCH_STRATEGIES) %>
#
Expand Down Expand Up @@ -379,7 +379,7 @@ def with_avatar_item(**system_arguments)
# @param open_on_load [Boolean] Open the panel when the page loads.
# @param anchor_align [Symbol] The anchor alignment of the Overlay. <%= one_of(Primer::Alpha::Overlay::ANCHOR_ALIGN_OPTIONS) %>
# @param anchor_side [Symbol] The side to anchor the Overlay to. <%= one_of(Primer::Alpha::Overlay::ANCHOR_SIDE_OPTIONS) %>
# @param banner_variant [Symbol] The scheme for the error banner <%= one_of(Primer::Alpha::SelectPanel::BANNER_VARIANT_OPTIONS) %>
# @param banner_scheme [Symbol] The scheme for the error banner <%= one_of(Primer::Alpha::SelectPanel::BANNER_SCHEME_OPTIONS) %>
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
def initialize(
src: nil,
Expand All @@ -400,7 +400,7 @@ def initialize(
open_on_load: false,
anchor_align: Primer::Alpha::Overlay::DEFAULT_ANCHOR_ALIGN,
anchor_side: Primer::Alpha::Overlay::DEFAULT_ANCHOR_SIDE,
banner_variant: DEFAULT_BANNER_VARIANT,
banner_scheme: DEFAULT_BANNER_SCHEME,
**system_arguments
)
raise_if_role_given!(**system_arguments)
Expand All @@ -422,7 +422,7 @@ def initialize(
@dynamic_label = dynamic_label
@dynamic_label_prefix = dynamic_label_prefix
@dynamic_aria_label_prefix = dynamic_aria_label_prefix
@banner_variant = fetch_or_fallback(BANNER_VARIANT_OPTIONS, banner_variant, DEFAULT_BANNER_VARIANT)
@banner_scheme = fetch_or_fallback(BANNER_SCHEME_OPTIONS, banner_scheme, DEFAULT_BANNER_SCHEME)

@system_arguments = deny_tag_argument(**system_arguments)
@system_arguments[:id] = @panel_id
Expand Down
5 changes: 2 additions & 3 deletions test/system/alpha/select_panel_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -671,8 +671,8 @@ def test_multi_select_allows_server_to_check_multiple_items
assert_selector "[aria-checked=true]", text: "Photon torpedo"
end

def test_banner_variant_is_passed_to_banner_component
visit_preview(:remote_fetch_filter_failure, banner_variant: :warning)
def test_banner_scheme_is_passed_to_banner_component
visit_preview(:remote_fetch_filter_failure, banner_scheme: :warning)

wait_for_items_to_load do
click_on_invoker_button
Expand All @@ -685,7 +685,6 @@ def test_banner_variant_is_passed_to_banner_component
end

assert_selector "[data-target='select-panel.bannerErrorElement'] .Banner--warning", text: "Sorry, something went wrong"
assert_selector ".Banner-message .fgColor-attention", text: "Sorry, something went wrong"
end

########## JAVASCRIPT API TESTS ############
Expand Down

0 comments on commit dcf48df

Please sign in to comment.