Skip to content

Commit d144cc7

Browse files
committed
Share alert animation controller between alert and toast components
1 parent bba05e2 commit d144cc7

File tree

4 files changed

+10
-30
lines changed

4 files changed

+10
-30
lines changed

admin/app/components/solidus_admin/ui/alert/component.html.erb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
transform -translate-y-[150%] opacity-0 duration-500
66
<%= SCHEMES.fetch(@scheme.to_sym).join(' ') %>
77
"
8-
data-controller="<%= stimulus_id %>"
9-
data-<%= stimulus_id %>-animation-class="-translate-y-[150%] opacity-0"
10-
data-<%= stimulus_id %>-transition-value="<%= Rails.env.test? ? 1000 : 500 %>"
8+
data-controller="alert-animation"
9+
data-alert-animation-animation-class="-translate-y-[150%] opacity-0"
10+
data-alert-animation-transition-value="<%= Rails.env.test? ? 1000 : 500 %>"
1111
role="dialog"
1212
aria-label="<%= t(".#{@scheme}_label") %>"
1313
aria-live="polite"
@@ -26,8 +26,8 @@
2626
type="button"
2727
title="<%= t(".close") %>"
2828
aria-label="<%= t(".close") %>"
29-
data-action="<%= stimulus_id %>#close"
30-
data-<%= stimulus_id %>-target="closeButton"
29+
data-action="alert-animation#close"
30+
data-alert-animation-target="closeButton"
3131
>
3232
<%= icon_tag('close-fill', class: "w-6 h-6 #{ICONS.dig(@scheme.to_sym, :class)}") %>
3333
</button>

admin/app/components/solidus_admin/ui/toast/component.html.erb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
pointer-events-auto
77
<%= SCHEMES.fetch(@scheme.to_sym).join(' ') %>
88
"
9-
data-controller="<%= stimulus_id %>"
10-
data-<%= stimulus_id %>-animation-class="translate-y-full opacity-0"
11-
data-<%= stimulus_id %>-transition-value="<%= Rails.env.test? ? 1000 : 500 %>"
9+
data-controller="alert-animation"
10+
data-alert-animation-animation-class="translate-y-full opacity-0"
11+
data-alert-animation-transition-value="<%= Rails.env.test? ? 1000 : 500 %>"
1212
role="dialog"
1313
aria-label="<%= t(".#{@scheme}_label") %>"
1414
aria-live="polite"
@@ -21,9 +21,9 @@
2121
type="button"
2222
class="ml-2 align-text-bottom"
2323
title="<%= t('.close_text') %>"
24-
data-action="<%= stimulus_id %>#close"
24+
data-action="alert-animation#close"
2525
aria-label="<%= t('.close_text') %>"
26-
data-<%= stimulus_id %>-target="closeButton"
26+
data-alert-animation-target="closeButton"
2727
>
2828
<%= icon_tag('close-line', class: "w-[1.125rem] h-[1.125rem] fill-current") %>
2929
</button>

admin/app/components/solidus_admin/ui/toast/component.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

admin/app/components/solidus_admin/ui/alert/component.js renamed to admin/app/javascript/solidus_admin/controllers/alert_animation_controller.js

File renamed without changes.

0 commit comments

Comments
 (0)