Module: CCS::FrontendHelpers::GovUKFrontend::NotificationBanner

Included in:
CCS::FrontendHelpers::GovUKFrontend
Defined in:
lib/ccs/frontend_helpers/govuk_frontend/notification_banner.rb

Overview

GOV.UK Notification Banner

This helper is used for generating the notification banner component from the GDS - Components - Notification banner

Instance Method Summary collapse

Instance Method Details

#govuk_notification_banner(text = nil, success_banner = nil) { ... } ⇒ ActiveSupport::SafeBuffer

Generates the HTML for the GOV.UK Notification banner component

Parameters:

  • text (String) (defaults to: nil)

    the text that will be used for the heading in the content section of the banner. It is ignored if a block is given

  • success_banner (Boolean) (defaults to: nil)

    will use the success banner options if this is set to true

  • options (Hash)

    options that will be used in customising the HTML

Yields:

  • HTML that will be contained within the ‘govuk-notification-banner__content’ div

Returns:

  • (ActiveSupport::SafeBuffer)


24
25
26
# File 'lib/ccs/frontend_helpers/govuk_frontend/notification_banner.rb', line 24

def govuk_notification_banner(text = nil, success_banner = nil, **, &)
  Components::GovUK::NotificationBanner.new(context: self, text: text, success_banner: success_banner, **).render(&)
end