Class: Pulse::Label
- Inherits:
-
Component
- Object
- Component
- Pulse::Label
- Defined in:
- app/components/pulse/label.rb
Overview
A kind of badge. Used for displaying github labels. Perhaps could be consolidated with badges? Accepts Hex color value for bg_color, with or without a leading "#"
Instance Attribute Summary collapse
-
#bg_color ⇒ Object
readonly
Returns the value of attribute bg_color.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(title:, bg_color: 'ffffff', **options) ⇒ Label
constructor
A new instance of Label.
Constructor Details
#initialize(title:, bg_color: 'ffffff', **options) ⇒ Label
Returns a new instance of Label.
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/components/pulse/label.rb', line 10 def initialize(title:, bg_color: 'ffffff', **) @title = title @bg_color = bg_color || 'ffffff' @options = @options[:classes] = merge_classes( 'pulse-px-2 pulse-inline-flex pulse-text-xs print:pulse-text-2xs', 'pulse-leading-5 pulse-font-semibold pulse-rounded-full', text_color, [:classes] ) @options[:tag] ||= :span end |
Instance Attribute Details
#bg_color ⇒ Object (readonly)
Returns the value of attribute bg_color.
8 9 10 |
# File 'app/components/pulse/label.rb', line 8 def bg_color @bg_color end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
8 9 10 |
# File 'app/components/pulse/label.rb', line 8 def title @title end |