SpinaCMS/Spina

View on GitHub
app/components/spina/user_interface/flash_message_component.rb

Summary

Maintainability
A
0 mins
Test Coverage
module Spina
  module UserInterface
    class FlashMessageComponent < ApplicationComponent
      def initialize(type:, message:)
        @type = type
        @message = message
      end

      def confetti?
        @type == "confetti" && !Spina.config.party_pooper
      end

      def theme
        case @type
        when "alert", "error"
          "bg-red-400"
        else
          "bg-gray-400"
        end
      end
    end
  end
end