Skip to content

Commit e8a5321

Browse files
committed
Add component preview
1 parent 8a2644c commit e8a5321

File tree

3 files changed

+23
-18
lines changed

3 files changed

+23
-18
lines changed

admin/spec/components/previews/solidus_admin/ui/modal/component_preview.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ def with_form
1212
render_with_template
1313
end
1414

15-
def with_actions
16-
render_with_template
15+
# @param title text
16+
# @param body text
17+
# @param button text
18+
def confirmation(title: "Are you sure?", body: "You are about to delete something. This cannot be undone.", button: "Confirm")
19+
render_with_template(locals: { title:, body:, button: })
1720
end
1821
end
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<section>
2+
<div class="mb-8 text-lg">
3+
<form>
4+
<%= render component("ui/button").new(
5+
type: :submit,
6+
scheme: :secondary,
7+
text: "Summon confirmation modal",
8+
data: {
9+
"turbo-confirm": title,
10+
"confirm-details": body,
11+
"confirm-button": button
12+
}
13+
) %>
14+
</form>
15+
</div>
16+
17+
<%= render component("ui/modal/confirm").new %>
18+
</section>

admin/spec/components/previews/solidus_admin/ui/modal/component_preview/with_actions.html.erb

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

0 commit comments

Comments
 (0)