Class: IronAdmin::Ui::EmptyStateComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- IronAdmin::Ui::EmptyStateComponent
- Defined in:
- app/components/iron_admin/ui/empty_state_component.rb
Overview
Renders an empty state placeholder when no records exist.
Instance Attribute Summary collapse
-
#action_href ⇒ String?
readonly
Action button URL.
-
#action_text ⇒ String?
readonly
Action button text.
-
#description ⇒ String?
readonly
Description text.
-
#icon ⇒ String
readonly
Heroicon name.
-
#title ⇒ String
readonly
Title text.
Instance Method Summary collapse
-
#has_action? ⇒ Boolean
private
Whether action button should be shown.
-
#initialize(title: "No results found", description: nil, icon: "inbox", action_text: nil, action_href: nil) ⇒ EmptyStateComponent
constructor
A new instance of EmptyStateComponent.
-
#theme ⇒ IronAdmin::Configuration::Theme
private
Theme configuration.
Constructor Details
#initialize(title: "No results found", description: nil, icon: "inbox", action_text: nil, action_href: nil) ⇒ EmptyStateComponent
Returns a new instance of EmptyStateComponent.
33 34 35 36 37 38 39 40 |
# File 'app/components/iron_admin/ui/empty_state_component.rb', line 33 def initialize(title: "No results found", description: nil, icon: "inbox", action_text: nil, action_href: nil) @title = title @description = description @icon = icon @action_text = action_text @action_href = action_href end |
Instance Attribute Details
#action_href ⇒ String? (readonly)
Returns Action button URL.
26 27 28 |
# File 'app/components/iron_admin/ui/empty_state_component.rb', line 26 def action_href @action_href end |
#action_text ⇒ String? (readonly)
Returns Action button text.
23 24 25 |
# File 'app/components/iron_admin/ui/empty_state_component.rb', line 23 def action_text @action_text end |
#description ⇒ String? (readonly)
Returns Description text.
17 18 19 |
# File 'app/components/iron_admin/ui/empty_state_component.rb', line 17 def description @description end |
#icon ⇒ String (readonly)
Returns Heroicon name.
20 21 22 |
# File 'app/components/iron_admin/ui/empty_state_component.rb', line 20 def icon @icon end |
#title ⇒ String (readonly)
Returns Title text.
14 15 16 |
# File 'app/components/iron_admin/ui/empty_state_component.rb', line 14 def title @title end |
Instance Method Details
#has_action? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns Whether action button should be shown.
50 51 52 |
# File 'app/components/iron_admin/ui/empty_state_component.rb', line 50 def has_action? action_text.present? && action_href.present? end |
#theme ⇒ IronAdmin::Configuration::Theme
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns Theme configuration.
44 45 46 |
# File 'app/components/iron_admin/ui/empty_state_component.rb', line 44 def theme IronAdmin.configuration.theme end |