Class: Flowbite::Link

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/flowbite/link.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(href:, **options) ⇒ Link

Returns a new instance of Link.



11
12
13
14
15
# File 'app/components/flowbite/link.rb', line 11

def initialize(href:, **options)
  super()
  @href = href
  @options = options
end

Instance Attribute Details

#hrefObject (readonly)

Returns the value of attribute href.



3
4
5
# File 'app/components/flowbite/link.rb', line 3

def href
  @href
end

#optionsObject (readonly)

Returns the value of attribute options.



3
4
5
# File 'app/components/flowbite/link.rb', line 3

def options
  @options
end

#textObject (readonly)

Returns the value of attribute text.



3
4
5
# File 'app/components/flowbite/link.rb', line 3

def text
  @text
end

Class Method Details

.classesObject



6
7
8
# File 'app/components/flowbite/link.rb', line 6

def classes
  ["font-medium", "text-blue-600", "dark:text-blue-500", "hover:underline"].join(" ")
end

Instance Method Details

#callObject



17
18
19
# File 'app/components/flowbite/link.rb', line 17

def call
  link_to(content, href, {class: self.class.classes}.merge(options))
end