Sha256: 65908b0801c33331cf634fcfddc204888191625f5c3ebc250e98790e6c2c9d71

Contents?: true

Size: 1.84 KB

Versions: 42

Compression:

Stored size: 1.84 KB

Contents

# frozen_string_literal: true

module UiBibz::Helpers::Ui::Core::NotificationsHelper
  # Alert Component
  #
  # +options+ (Hash)
  # +html_options+ (Hash)
  #
  def ui_alert(content = nil, options = nil, html_options = nil, &block)
    if tapped?(block)
      UiBibz::Ui::Core::Notifications::Alert.new(content, options, html_options).tap(&block).render
    else
      UiBibz::Ui::Core::Notifications::Alert.new(content, options, html_options, &block).render
    end
  end

  # Badge (Label) Component
  #
  # +options+ (Hash)
  # +html_options+ (Hash)
  #
  def ui_badge(content = nil, options = nil, html_options = nil, &block)
    UiBibz::Ui::Core::Notifications::Badge.new(content, options, html_options, &block).render
  end

  # ProgressBar Component
  #
  # +options+ (Hash)
  # +html_options+ (Hash)
  def ui_progress_bar(percentage = nil, options = nil, html_options = nil, &block)
    if tapped?(block)
      UiBibz::Ui::Core::Notifications::ProgressBar.new(percentage, options, html_options).tap(&block).render
    else
      UiBibz::Ui::Core::Notifications::ProgressBar.new(percentage, options, html_options, &block).render
    end
  end

  # Toast Component
  #
  # +options+ (Hash)
  # +html_options+ (Hash)
  def ui_toast(content = nil, options = nil, html_options = nil, &block)
    if tapped?(block)
      UiBibz::Ui::Core::Notifications::Toast.new(content, options, html_options).tap(&block).render
    else
      UiBibz::Ui::Core::Notifications::Toast.new(content, options, html_options, &block).render
    end
  end

  # Spinner Component
  #
  # +options+ (Hash)
  # +html_options+ (Hash)
  #
  def ui_spinner(content = nil, options = nil, html_options = nil, &block)
    UiBibz::Ui::Core::Notifications::Spinner.new(content, options, html_options, &block).render
  end

  private

  def tapped?(block)
    UiBibz::Utils::Screwdriver.tapped?(block)
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
ui_bibz-3.0.13 lib/ui_bibz/helpers/ui/core/notifications_helper.rb
ui_bibz-3.0.12 lib/ui_bibz/helpers/ui/core/notifications_helper.rb
ui_bibz-3.0.11 lib/ui_bibz/helpers/ui/core/notifications_helper.rb
ui_bibz-3.0.10 lib/ui_bibz/helpers/ui/core/notifications_helper.rb
ui_bibz-3.0.9 lib/ui_bibz/helpers/ui/core/notifications_helper.rb
ui_bibz-3.0.8 lib/ui_bibz/helpers/ui/core/notifications_helper.rb
ui_bibz-3.0.7 lib/ui_bibz/helpers/ui/core/notifications_helper.rb
ui_bibz-3.0.6 lib/ui_bibz/helpers/ui/core/notifications_helper.rb
ui_bibz-3.0.5 lib/ui_bibz/helpers/ui/core/notifications_helper.rb
ui_bibz-3.0.4 lib/ui_bibz/helpers/ui/core/notifications_helper.rb
ui_bibz-3.0.3 lib/ui_bibz/helpers/ui/core/notifications_helper.rb
ui_bibz-3.0.2 lib/ui_bibz/helpers/ui/core/notifications_helper.rb
ui_bibz-3.0.1 lib/ui_bibz/helpers/ui/core/notifications_helper.rb
ui_bibz-3.0.0 lib/ui_bibz/helpers/ui/core/notifications_helper.rb
ui_bibz-3.0.0.beta19 lib/ui_bibz/helpers/ui/core/notifications_helper.rb
ui_bibz-3.0.0.beta18 lib/ui_bibz/helpers/ui/core/notifications_helper.rb
ui_bibz-3.0.0.beta17 lib/ui_bibz/helpers/ui/core/notifications_helper.rb
ui_bibz-3.0.0.beta16 lib/ui_bibz/helpers/ui/core/notifications_helper.rb
ui_bibz-3.0.0.beta15 lib/ui_bibz/helpers/ui/core/notifications_helper.rb
ui_bibz-3.0.0.beta14 lib/ui_bibz/helpers/ui/core/notifications_helper.rb