Class: IronAdmin::Dashboards::ActivityFeedComponent::ItemComponent Private
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- IronAdmin::Dashboards::ActivityFeedComponent::ItemComponent
- Defined in:
- app/components/iron_admin/dashboards/activity_feed_component.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Individual activity feed item component.
Constant Summary collapse
- COLORS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Color classes for icon backgrounds.
{ green: "bg-green-100 text-green-600", red: "bg-red-100 text-red-600", blue: "bg-blue-100 text-blue-600", yellow: "bg-yellow-100 text-yellow-600", gray: "bg-gray-100 text-gray-600", }.freeze
Instance Attribute Summary collapse
-
#description ⇒ String
readonly
private
Item description.
-
#href ⇒ String?
readonly
private
Optional link URL.
-
#icon ⇒ String
readonly
private
Icon name.
-
#icon_color ⇒ Symbol
readonly
private
Icon color.
-
#timestamp ⇒ Time, String
readonly
private
Item timestamp.
Instance Method Summary collapse
-
#formatted_timestamp ⇒ String
private
Formatted timestamp string.
-
#icon_classes ⇒ String
private
CSS classes for icon background color.
-
#initialize(description:, timestamp:, icon: "circle-stack", icon_color: :blue, href: nil) ⇒ ItemComponent
constructor
private
A new instance of ItemComponent.
-
#theme ⇒ IronAdmin::Configuration::Theme
private
Theme configuration.
Constructor Details
#initialize(description:, timestamp:, icon: "circle-stack", icon_color: :blue, href: nil) ⇒ ItemComponent
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 a new instance of ItemComponent.
62 63 64 65 66 67 68 |
# File 'app/components/iron_admin/dashboards/activity_feed_component.rb', line 62 def initialize(description:, timestamp:, icon: "circle-stack", icon_color: :blue, href: nil) @description = description @timestamp = @icon = icon @icon_color = icon_color.to_sym @href = href end |
Instance Attribute Details
#description ⇒ String (readonly)
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 Item description.
39 40 41 |
# File 'app/components/iron_admin/dashboards/activity_feed_component.rb', line 39 def description @description end |
#href ⇒ String? (readonly)
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 Optional link URL.
45 46 47 |
# File 'app/components/iron_admin/dashboards/activity_feed_component.rb', line 45 def href @href end |
#icon ⇒ String (readonly)
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 Icon name.
33 34 35 |
# File 'app/components/iron_admin/dashboards/activity_feed_component.rb', line 33 def icon @icon end |
#icon_color ⇒ Symbol (readonly)
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 Icon color.
36 37 38 |
# File 'app/components/iron_admin/dashboards/activity_feed_component.rb', line 36 def icon_color @icon_color end |
#timestamp ⇒ Time, String (readonly)
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 Item timestamp.
42 43 44 |
# File 'app/components/iron_admin/dashboards/activity_feed_component.rb', line 42 def @timestamp end |
Instance Method Details
#formatted_timestamp ⇒ String
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 Formatted timestamp string.
84 85 86 87 88 89 90 |
# File 'app/components/iron_admin/dashboards/activity_feed_component.rb', line 84 def if .respond_to?(:strftime) .strftime("%b %d, %H:%M") else end end |
#icon_classes ⇒ String
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 CSS classes for icon background color.
78 79 80 |
# File 'app/components/iron_admin/dashboards/activity_feed_component.rb', line 78 def icon_classes COLORS[@icon_color] || COLORS[:gray] 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.
72 73 74 |
# File 'app/components/iron_admin/dashboards/activity_feed_component.rb', line 72 def theme IronAdmin.configuration.theme end |