Sha256: 77f5c9bd2df708e8cd3290069293ecd2a2f222db15943e302f31c32aa4956181

Contents?: true

Size: 882 Bytes

Versions: 4

Compression:

Stored size: 882 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-active"
        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

4 entries across 4 versions & 1 rubygems

Version Path
panda_cms-0.6.3 app/components/panda_cms/admin/flash_message_component.rb
panda_cms-0.6.2 app/components/panda_cms/admin/flash_message_component.rb
panda_cms-0.6.1 app/components/panda_cms/admin/flash_message_component.rb
panda_cms-0.6.0 app/components/panda_cms/admin/flash_message_component.rb