Sha256: 6f6e98f8f45d3d58771699cdb881a37fa159533b77cccf3eafaaba264f0385df

Contents?: true

Size: 703 Bytes

Versions: 3

Compression:

Stored size: 703 Bytes

Contents

module Rosetta
  module NavigationHelper
    def tab_link_to(name = nil, options = nil, html_options = nil, &block)
      is_current_page = current_page?(block_given? ? name : options)

      css_classes = class_names(
        "flex group whitespace-nowrap border-b-2 px-1 py-4 text-sm font-medium",
        "active border-indigo-500 text-indigo-600": is_current_page,
        "border-transparent text-gray-500 hover:border-gray-200 hover:text-gray-700": !is_current_page
      )

      html_options = { class: css_classes, aria: { current: "page" } }

      if block_given?
        link_to(name, html_options, &block)
      else
        link_to(name, options, html_options)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rosetta-rails-0.2.1 app/helpers/rosetta/navigation_helper.rb
rosetta-rails-0.2.0 app/helpers/rosetta/navigation_helper.rb
rosetta-rails-0.1.1 app/helpers/rosetta/navigation_helper.rb