# Flash messages helper for consistent styling across the application
#
# Provides standardized CSS classes and icons for different types of flash messages
# using Tailwind CSS classes and Lucide icons for consistent UI presentation
module FlashMessagesHelper
# Return appropriate Tailwind CSS classes for different flash message types
#
# @param type [String, Symbol] The flash message type (notice, error, warning, info)
# @return [String] Tailwind CSS classes for styling the flash message container
#
# Examples:
# flash_class('success') # => "bg-green-50 text-green-800 border-green-200"
# flash_class('error') # => "bg-red-50 text-red-800 border-red-200"
def flash_class(type)
case type.to_s
when "notice", "success"
"bg-green-50 text-green-800 border-green-200"
when "error", "alert"
"bg-red-50 text-red-800 border-red-200"
when "warning"
"bg-yellow-50 text-yellow-800 border-yellow-200"
when "info"
"bg-blue-50 text-blue-800 border-blue-200"
else
"bg-gray-50 text-gray-800 border-gray-200"
end
end
# Return appropriate Lucide icon for different flash message types
#
# @param type [String, Symbol] The flash message type
# @return [String] HTML content tag with Lucide icon data attribute
#
# Examples:
# flash_icon('success') # =>
# flash_icon('error') # =>
def flash_icon(type)
case type.to_s
when "notice", "success"
content_tag :i, "", "data-lucide": "check-circle", class: "w-5 h-5 flex-shrink-0"
when "error", "alert"
content_tag :i, "", "data-lucide": "x-circle", class: "w-5 h-5 flex-shrink-0"
when "warning"
content_tag :i, "", "data-lucide": "alert-triangle", class: "w-5 h-5 flex-shrink-0"
when "info"
content_tag :i, "", "data-lucide": "info", class: "w-5 h-5 flex-shrink-0"
else
content_tag :i, "", "data-lucide": "bell", class: "w-5 h-5 flex-shrink-0"
end
end
end