# frozen_string_literal: true class NotificationComponent < ViewComponent::Base def initialize(type:, data:) @type = type @data = prepare_data(data) @icon_name = icon_name @icon_color_class = icon_color_class end def prepare_data(data) case data when Hash data else { title: data } end end def icon_name case @type when 'success' 'check-circle' when 'error' 'alert-octagon' when 'alert' 'alert-octagon' else 'info' end end def icon_color_class case @type when 'success' 'text-emerald-500' when 'error' 'text-rose-600' when 'alert' 'text-rose-600' else 'text-gray-400' end end end