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

Additional legacy flash/banner classes; fix data-target issue #1559

Merged
merged 2 commits into from
Nov 3, 2022
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/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