diff --git a/app/lib/form_builders/tailwind.rb b/app/lib/form_builders/tailwind.rb index 82f28931a..6e53650e8 100644 --- a/app/lib/form_builders/tailwind.rb +++ b/app/lib/form_builders/tailwind.rb @@ -50,9 +50,13 @@ def error(method, options = {}) template.content_tag(:p, m, options.merge(class: "text-2xl text-error-red #{options[:class]}")) end - sig { params(text: String, options: T::Hash[Symbol, String]).returns(String) } - def hint(text, options = {}) - template.content_tag(:p, text, options.merge(class: "text-base italic text-warm-grey #{options[:class]}")) + sig { params(text_or_options: T.untyped, options: T::Hash[Symbol, String], block: T.untyped).returns(String) } + def hint(text_or_options = nil, options = {}, &block) + if block_given? + template.content_tag(:p, (text_or_options || {}).merge(class: "text-base italic text-warm-grey #{options[:class]}"), &block) + else + template.content_tag(:p, text_or_options, options.merge(class: "text-base italic text-warm-grey #{options[:class]}")) + end end sig { params(method: Symbol, options: T::Hash[Symbol, String]).returns(String) } diff --git a/app/views/_tailwind/contact_messages/_form.html.erb b/app/views/_tailwind/contact_messages/_form.html.erb index 065c72448..5a61ecb28 100644 --- a/app/views/_tailwind/contact_messages/_form.html.erb +++ b/app/views/_tailwind/contact_messages/_form.html.erb @@ -5,7 +5,9 @@ <%= f.label :name, "Your name", class: "block mb-3" %> <%= f.text_field :name, class: "block w-full" %> <%= f.error :name, class: "mt-2" %> - <%= f.hint "Or #{pa_link_to 'sign in', new_user_session_path}".html_safe %> + <%= f.hint do %> + Or <%= pa_link_to "sign in", new_user_session_path %> + <% end %>