Skip to content

Commit

Permalink
Additional legacy flash/banner classes; fix data-target issue (#1559)
Browse files Browse the repository at this point in the history
  • Loading branch information
camertron authored Nov 3, 2022
1 parent bc235b3 commit b534001
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/light-crabs-hear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/view-components': patch
---

Additional legacy flash/banner classes; fix data-target issue
4 changes: 2 additions & 2 deletions app/components/primer/beta/banner.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
<% end %>
<% end %>
<% if action %>
<div class="Banner-actions">
<div class="flash-action Banner-actions">
<%= action %>
</div>
<% end %>
<% if @dismissible %>
<div class="Banner-close">
<div class="flash-close Banner-close">
<%= render(
Primer::Beta::IconButton.new(
scheme: :invisible,
Expand Down
5 changes: 2 additions & 3 deletions app/components/primer/beta/banner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,6 @@ def initialize(full: false, full_when_narrow: false, dismissible: false, descrip

@system_arguments = deny_tag_argument(**system_arguments)
@system_arguments[:tag] = :div
@system_arguments[:data] ||= {}
@system_arguments[:data][:target] = catalyst_target(field: "root")
@system_arguments[:data][:reappear] = @reappear if @reappear
@system_arguments[:classes] = class_names(
@system_arguments[:classes],
"Banner",
Expand All @@ -118,6 +115,8 @@ def initialize(full: false, full_when_narrow: false, dismissible: false, descrip
@wrapper_arguments = {
tag: custom_element_name
}

@wrapper_arguments[:data] = { reappear: @reappear } if @reappear
end

private
Expand Down
5 changes: 2 additions & 3 deletions app/components/primer/beta/x_banner.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import {controller, target} from '@github/catalyst'

@controller
class XBannerElement extends HTMLElement {
@target root: HTMLElement
export class XBannerElement extends HTMLElement {
@target titleText: HTMLElement

dismiss() {
Expand All @@ -23,7 +22,7 @@ class XBannerElement extends HTMLElement {
}

private shouldReappear(): boolean {
return this.root.getAttribute('data-reappear') === 'true'
return this.getAttribute('data-reappear') === 'true'
}
}

Expand Down

0 comments on commit b534001

Please sign in to comment.