Previews

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<%= render(Primer::Alpha::Overlay.new(title: "An overlay", id: "first-overlay")) do |o| %>
<% o.with_show_button() { "Show overlay" } %>
<% o.with_body() do %>
<%= render(Primer::Alpha::Dialog.new(id: "dialog-one", title: title, position: position, subtitle: subtitle, visually_hide_title: false)) do |d| %>
<% d.with_show_button { button_text } %>
<% d.with_body { body_text } %>
<% d.with_footer(show_divider: true) do %>
<%= render(Primer::Beta::Button.new(data: { "close-dialog-id": "dialog-one" })) { "Cancel" } %>
<% end %>
<% end %>
<% end %>
<% end %>
<script>
document.getElementById('overlay-show-first-overlay')?.addEventListener('click', e => {
setTimeout(() => {
document.getElementById('first-overlay').querySelector('button')?.click()
});
});
</script>