Class: Trek::Toaster::ToastComponent::LinkComponent
- Inherits:
-
Component
- Object
- ViewComponent::Base
- Component
- Trek::Toaster::ToastComponent::LinkComponent
show all
- Defined in:
- app/components/trek/toaster/toast_component.rb
Instance Method Summary
collapse
#stimulus_action, #stimulus_class, #stimulus_class_hash, #stimulus_class_key, #stimulus_target, #stimulus_target_hash, #stimulus_target_key, #stimulus_value, #stimulus_value_hash, #stimulus_value_key
#class_for, #class_names_for, #root_class
#identifier
Instance Method Details
#call ⇒ Object
37
38
39
|
# File 'app/components/trek/toaster/toast_component.rb', line 37
def call
link_to(rendered_text, href, params)
end
|
#icon ⇒ Object
52
53
54
55
56
|
# File 'app/components/trek/toaster/toast_component.rb', line 52
def icon
return if target != "_blank"
render IconComponent.new("external", classnames: class_for("icon"))
end
|
#params ⇒ Object
58
59
60
61
62
63
64
|
# File 'app/components/trek/toaster/toast_component.rb', line 58
def params
{
rel:,
target:,
class: root_class
}
end
|
#render? ⇒ Boolean
48
49
50
|
# File 'app/components/trek/toaster/toast_component.rb', line 48
def render?
text.present? && href.present?
end
|
#rendered_text ⇒ Object
41
42
43
44
45
46
|
# File 'app/components/trek/toaster/toast_component.rb', line 41
def rendered_text
safe_join([
text,
icon
])
end
|