Class: Anchor::LinkComponent

Inherits:
Component
  • Object
show all
Defined in:
app/components/anchor/link_component.rb

Constant Summary collapse

VARIANT_DEFAULT =
:accent
VARIANT_MAPPINGS =
{
  VARIANT_DEFAULT => "text-accent hover:text-accent-hover",
  :secondary => "text-secondary hover:text-primary",
}.freeze
VARIANT_OPTIONS =
VARIANT_MAPPINGS.keys

Constants included from ViewHelper

ViewHelper::ANCHOR_HELPERS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Component

generate_id

Methods included from ViewHelper

#anchor_form_with, #anchor_svg, #deep_blank?, #merge_options, #popover_trigger_attributes

Methods included from FetchOrFallbackHelper

#fetch_or_fallback

Constructor Details

#initialize(href:, **kwargs) ⇒ LinkComponent

Returns a new instance of LinkComponent.



10
11
12
13
14
# File 'app/components/anchor/link_component.rb', line 10

def initialize(href:, **kwargs)
  @href = href

  super(**kwargs)
end

Instance Attribute Details

#hrefObject (readonly)

Returns the value of attribute href.



16
17
18
# File 'app/components/anchor/link_component.rb', line 16

def href
  @href
end

Instance Method Details

#render?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'app/components/anchor/link_component.rb', line 18

def render?
  content?
end