Class: Solrengine::Ui::NotificationComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Solrengine::Ui::NotificationComponent
- Defined in:
- app/components/solrengine/ui/notification_component.rb
Constant Summary collapse
- VARIANTS =
{ success: "bg-green-50 dark:bg-green-900/20 text-green-800 dark:text-green-300 border-green-200 dark:border-green-800", error: "bg-red-50 dark:bg-red-900/20 text-red-800 dark:text-red-300 border-red-200 dark:border-red-800", warning: "bg-yellow-50 dark:bg-yellow-900/20 text-yellow-800 dark:text-yellow-300 border-yellow-200 dark:border-yellow-800", info: "bg-blue-50 dark:bg-blue-900/20 text-blue-800 dark:text-blue-300 border-blue-200 dark:border-blue-800" }.freeze
- ICONS =
{ success: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z", error: "M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z", warning: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z", info: "M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }.freeze
Instance Attribute Summary collapse
-
#dismissible ⇒ Object
readonly
Returns the value of attribute dismissible.
-
#explorer_url ⇒ Object
readonly
Returns the value of attribute explorer_url.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #icon_path ⇒ Object
-
#initialize(message:, type: :info, dismissible: true, explorer_url: nil) ⇒ NotificationComponent
constructor
A new instance of NotificationComponent.
- #variant_classes ⇒ Object
Constructor Details
#initialize(message:, type: :info, dismissible: true, explorer_url: nil) ⇒ NotificationComponent
Returns a new instance of NotificationComponent.
22 23 24 25 26 27 |
# File 'app/components/solrengine/ui/notification_component.rb', line 22 def initialize(message:, type: :info, dismissible: true, explorer_url: nil) @type = type @message = @dismissible = dismissible @explorer_url = explorer_url end |
Instance Attribute Details
#dismissible ⇒ Object (readonly)
Returns the value of attribute dismissible.
20 21 22 |
# File 'app/components/solrengine/ui/notification_component.rb', line 20 def dismissible @dismissible end |
#explorer_url ⇒ Object (readonly)
Returns the value of attribute explorer_url.
20 21 22 |
# File 'app/components/solrengine/ui/notification_component.rb', line 20 def explorer_url @explorer_url end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
20 21 22 |
# File 'app/components/solrengine/ui/notification_component.rb', line 20 def @message end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
20 21 22 |
# File 'app/components/solrengine/ui/notification_component.rb', line 20 def type @type end |