Class: Primer::LinkComponent
- Defined in:
- app/components/primer/link_component.rb
Overview
Use links for moving from one page to another. The Link component styles anchor tags with default blue styling and hover text-decoration.
Constant Summary
Constants inherited from Component
Constants included from FetchOrFallbackHelper
FetchOrFallbackHelper::InvalidValueError
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(href:, muted: false, **system_arguments) ⇒ LinkComponent
constructor
A new instance of LinkComponent.
Methods included from ViewHelper
Methods included from JoinStyleArgumentsHelper
Methods included from FetchOrFallbackHelper
#fetch_or_fallback, #fetch_or_fallback_boolean
Methods included from ClassNameHelper
Constructor Details
#initialize(href:, muted: false, **system_arguments) ⇒ LinkComponent
Returns a new instance of LinkComponent.
15 16 17 18 19 20 21 22 23 |
# File 'app/components/primer/link_component.rb', line 15 def initialize(href:, muted: false, **system_arguments) @system_arguments = system_arguments @system_arguments[:tag] = :a @system_arguments[:href] = href @system_arguments[:classes] = class_names( @system_arguments[:classes], "muted-link" => fetch_or_fallback_boolean(muted, false) ) end |
Class Method Details
Instance Method Details
#call ⇒ Object
25 26 27 |
# File 'app/components/primer/link_component.rb', line 25 def call render(Primer::BaseComponent.new(**@system_arguments)) { content } end |