Class: Solrengine::Ui::TokenIconComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Solrengine::Ui::TokenIconComponent
- Defined in:
- app/components/solrengine/ui/token_icon_component.rb
Constant Summary collapse
- SIZES =
{ sm: "h-6 w-6", md: "h-8 w-8", lg: "h-10 w-10" }.freeze
Instance Attribute Summary collapse
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#symbol ⇒ Object
readonly
Returns the value of attribute symbol.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
- #fallback_letter ⇒ Object
-
#initialize(symbol:, uri: nil, size: :md) ⇒ TokenIconComponent
constructor
A new instance of TokenIconComponent.
- #size_class ⇒ Object
Constructor Details
#initialize(symbol:, uri: nil, size: :md) ⇒ TokenIconComponent
Returns a new instance of TokenIconComponent.
14 15 16 17 18 |
# File 'app/components/solrengine/ui/token_icon_component.rb', line 14 def initialize(symbol:, uri: nil, size: :md) @uri = uri @symbol = symbol @size = size end |
Instance Attribute Details
#size ⇒ Object (readonly)
Returns the value of attribute size.
12 13 14 |
# File 'app/components/solrengine/ui/token_icon_component.rb', line 12 def size @size end |
#symbol ⇒ Object (readonly)
Returns the value of attribute symbol.
12 13 14 |
# File 'app/components/solrengine/ui/token_icon_component.rb', line 12 def symbol @symbol end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
12 13 14 |
# File 'app/components/solrengine/ui/token_icon_component.rb', line 12 def uri @uri end |
Instance Method Details
#fallback_letter ⇒ Object
24 25 26 |
# File 'app/components/solrengine/ui/token_icon_component.rb', line 24 def fallback_letter symbol&.first&.upcase || "?" end |