Skip to content

Commit

Permalink
pa_link_to needs to support title option
Browse files Browse the repository at this point in the history
  • Loading branch information
mlandauer committed Feb 22, 2024
1 parent a367434 commit 57ec571
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,26 @@ def pa_link_classes

# Only to be used in tailwind theme
# TODO: Generalise to support all the variants
sig { params(body: T.untyped, url: T.untyped, extra_classes: T.nilable(String)).returns(String) }
def pa_link_to(body, url, extra_classes: nil)
sig { params(body: T.untyped, url: T.untyped, extra_classes: T.nilable(String), title: T.nilable(String)).returns(String) }
def pa_link_to(body, url, extra_classes: nil, title: nil)
# These extra classes can't override the default styling because they're at the end
link_to(body, url, class: "#{pa_link_classes} #{extra_classes}")
link_to(body, url, class: "#{pa_link_classes} #{extra_classes}", title:)
end

# Only to be used in tailwind theme
# TODO: Generalise to support all the variants
sig { params(body: T.untyped, url: T.untyped, extra_classes: T.nilable(String)).returns(String) }
def pa_link_to_unless_current(body, url, extra_classes: nil)
sig { params(body: T.untyped, url: T.untyped, extra_classes: T.nilable(String), title: T.nilable(String)).returns(String) }
def pa_link_to_unless_current(body, url, extra_classes: nil, title: nil)
# These extra classes can't override the default styling because they're at the end
link_to_unless_current(body, url, class: "#{pa_link_classes} #{extra_classes}")
link_to_unless_current(body, url, class: "#{pa_link_classes} #{extra_classes}", title:)
end

# Only to be used in tailwind theme
# TODO: Generalise to support all the variants
sig { params(condition: T::Boolean, body: T.untyped, url: T.untyped, extra_classes: T.nilable(String)).returns(String) }
def pa_link_to_unless(condition, body, url, extra_classes: nil)
sig { params(condition: T::Boolean, body: T.untyped, url: T.untyped, extra_classes: T.nilable(String), title: T.nilable(String)).returns(String) }
def pa_link_to_unless(condition, body, url, extra_classes: nil, title: nil)
# These extra classes can't override the default styling because they're at the end
link_to_unless(condition, body, url, class: "#{pa_link_classes} #{extra_classes}")
link_to_unless(condition, body, url, class: "#{pa_link_classes} #{extra_classes}", title:)
end

sig { params(path: String, extra_classes: T::Array[Symbol], block: T.untyped).returns(T.untyped) }
Expand Down

0 comments on commit 57ec571

Please sign in to comment.