Sha256: 85582c26decd3a9c7c26bd5ce92e412c2f84b864ed80fb2fedd7ff7fc659dac3

Contents?: true

Size: 646 Bytes

Versions: 21

Compression:

Stored size: 646 Bytes

Contents

# frozen_string_literal: true

class Avo::Sidebar::LinkComponent < ViewComponent::Base
  attr_reader :active
  attr_reader :target
  attr_reader :label
  attr_reader :path

  def initialize(label: nil, path: nil, active: :inclusive, target: nil)
    @label = label
    @path = path
    @active = active
    @target = target
  end

  def is_external?
    URI(path).scheme.present?
  end

  # For external links active_link_to marks them all as active.
  def link_method
    is_external? ? :link_to : :active_link_to
  end

  def classes
    "px-4 pr-0 flex-1 flex mx-6 leading-none py-2 text-black rounded font-medium hover:bg-gray-100"
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
avo-2.11.1.pre.1 app/components/avo/sidebar/link_component.rb
avo-2.11.0 app/components/avo/sidebar/link_component.rb
avo-2.10.3.pre.1 app/components/avo/sidebar/link_component.rb
avo-2.10.2 app/components/avo/sidebar/link_component.rb
avo-2.9.2.pre1 app/components/avo/sidebar/link_component.rb
avo-2.10.0 app/components/avo/sidebar/link_component.rb
avo-2.9.1.pre7 app/components/avo/sidebar/link_component.rb
avo-2.9.1.pre6 app/components/avo/sidebar/link_component.rb
avo-2.9.1.pre5 app/components/avo/sidebar/link_component.rb
avo-2.9.1.pre4 app/components/avo/sidebar/link_component.rb
avo-2.9.1.pre3 app/components/avo/sidebar/link_component.rb
avo-2.9.1.pre2 app/components/avo/sidebar/link_component.rb
avo-2.9.1.pre1 app/components/avo/sidebar/link_component.rb
avo-2.9.0 app/components/avo/sidebar/link_component.rb
avo-2.8.0 app/components/avo/sidebar/link_component.rb
avo-2.7.1.pre.1 app/components/avo/sidebar/link_component.rb
avo-2.7.0 app/components/avo/sidebar/link_component.rb
avo-2.6.1.pre.2 app/components/avo/sidebar/link_component.rb
avo-2.6.1.pre.1 app/components/avo/sidebar/link_component.rb
avo-2.6.0 app/components/avo/sidebar/link_component.rb