Sha256: 0acdea486349b6e2b29cb3b84aa859e7bb1cc827261cc7ae2e0c9ebe3b227f8b

Contents?: true

Size: 885 Bytes

Versions: 7

Compression:

Stored size: 885 Bytes

Contents

# frozen_string_literal: true

module PandaCms
  module Admin
    class FlashMessageComponent < ::ViewComponent::Base
      attr_reader :kind, :message

      def initialize(message:, kind:)
        @kind = kind.to_sym
        @message = message
      end

      def text_colour_css
        case kind
        when :success
          "text-active"
        when :alert, :error
          "text-error"
        when :warning
          "text-warning"
        when :info, :notice
          "text-highlight"
        else
          "text-mid"
        end
      end

      def icon_css
        case kind
        when :success
          "fa-circle-check"
        when :alert
          "fa-circle-xmark"
        when :warning
          "fa-triangle-exclamation"
        when :info, :notice
          "fa-circle-info"
        else
          "fa-circle-info"
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
panda_cms-0.5.10 app/components/panda_cms/admin/flash_message_component.rb
panda_cms-0.5.9 app/components/panda_cms/admin/flash_message_component.rb
panda_cms-0.5.8 app/components/panda_cms/admin/flash_message_component.rb
panda_cms-0.5.7 app/components/panda_cms/admin/flash_message_component.rb
panda_cms-0.5.6 app/components/panda_cms/admin/flash_message_component.rb
panda_cms-0.5.5 app/components/panda_cms/admin/flash_message_component.rb
panda_cms-0.5.4 app/components/panda_cms/admin/flash_message_component.rb