Class: Keystone::Ui::RadioCardComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Keystone::Ui::RadioCardComponent
- Defined in:
- app/components/keystone/ui/radio_card_component.rb
Constant Summary collapse
- BASE_CLASSES =
"block p-4 rounded-lg border-2 cursor-pointer transition"- HIGHLIGHT_CLASSES =
"border-surface-200 peer-checked:border-accent-500 peer-checked:bg-accent-50"- LABEL_CLASSES =
"block font-medium text-surface-900"- HINT_CLASSES =
"block mt-1 text-sm text-surface-500"
Instance Attribute Summary collapse
-
#hint ⇒ Object
readonly
Returns the value of attribute hint.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #checked? ⇒ Boolean
- #classes ⇒ Object
- #hint? ⇒ Boolean
- #hint_classes ⇒ Object
-
#initialize(name:, value:, label:, hint: nil, checked: false) ⇒ RadioCardComponent
constructor
A new instance of RadioCardComponent.
- #label_classes ⇒ Object
Constructor Details
#initialize(name:, value:, label:, hint: nil, checked: false) ⇒ RadioCardComponent
Returns a new instance of RadioCardComponent.
13 14 15 16 17 18 19 |
# File 'app/components/keystone/ui/radio_card_component.rb', line 13 def initialize(name:, value:, label:, hint: nil, checked: false) @name = name @value = value @label = label @hint = hint @checked = checked end |
Instance Attribute Details
#hint ⇒ Object (readonly)
Returns the value of attribute hint.
11 12 13 |
# File 'app/components/keystone/ui/radio_card_component.rb', line 11 def hint @hint end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
11 12 13 |
# File 'app/components/keystone/ui/radio_card_component.rb', line 11 def label @label end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
11 12 13 |
# File 'app/components/keystone/ui/radio_card_component.rb', line 11 def name @name end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
11 12 13 |
# File 'app/components/keystone/ui/radio_card_component.rb', line 11 def value @value end |
Instance Method Details
#checked? ⇒ Boolean
21 22 23 |
# File 'app/components/keystone/ui/radio_card_component.rb', line 21 def checked? @checked end |
#classes ⇒ Object
29 30 31 |
# File 'app/components/keystone/ui/radio_card_component.rb', line 29 def classes "#{BASE_CLASSES} #{HIGHLIGHT_CLASSES}" end |
#hint? ⇒ Boolean
25 26 27 |
# File 'app/components/keystone/ui/radio_card_component.rb', line 25 def hint? !@hint.nil? end |
#hint_classes ⇒ Object
37 38 39 |
# File 'app/components/keystone/ui/radio_card_component.rb', line 37 def hint_classes HINT_CLASSES end |
#label_classes ⇒ Object
33 34 35 |
# File 'app/components/keystone/ui/radio_card_component.rb', line 33 def label_classes LABEL_CLASSES end |