%
add_gem_component_stylesheet("single-page-notification-button")
local_assigns[:margin_bottom] ||= 3
js_enhancement ||= false
spnb_helper = GovukPublishingComponents::Presenters::SinglePageNotificationButtonHelper.new(local_assigns)
component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
component_helper.add_class("gem-c-single-page-notification-button")
component_helper.add_class("js-personalisation-enhancement") if local_assigns[:js_enhancement]
component_helper.add_data_attribute({ module: "single-page-notification-button" }) if js_enhancement
component_helper.add_data_attribute({ button_location: spnb_helper.button_location })
component_helper.add_data_attribute({ button_text_subscribe: spnb_helper.button_text_subscribe })
component_helper.add_data_attribute({ button_text_unsubscribe: spnb_helper.button_text_unsubscribe })
ga4_data_attributes = ga4_data_attributes ||= nil
ga4_link_data_attributes = ga4_data_attributes[:ga4_link] if ga4_data_attributes
ga4_link_data_attributes[:url] = spnb_helper.form_action if ga4_link_data_attributes
component_helper.add_class("govuk-!-display-none-print")
component_helper.add_data_attribute({ module: ga4_data_attributes[:module] }) if ga4_data_attributes
%>
<% button_text = capture do %>
<%= spnb_helper.button_text %>
<% end %>
<%= tag.div(**component_helper.all_attributes) do %>
<%= tag.form action: spnb_helper.form_action, method: "POST" do %>
<% if spnb_helper.skip_the_gov_uk_account? %>
<% end %>
<%= content_tag(:button, button_text, {
class: "govuk-body-s gem-c-single-page-notification-button__submit",
type: "submit",
data: {
ga4_link: ga4_link_data_attributes
}
}) %>
<% end %>
<% end if spnb_helper.base_path %>