trust
instead of peer
as I was previously
link
in Lucky? I've been trying with something like what's below, but it's trying to match the union type to a signature in Lucky::LinkHelpers
rather than each individual type and throwing a compile error :(class UI::CardActionHeader < BaseComponent
needs title : String
needs link_text : String
needs link_target : Lucky::Action.class | Lucky::RouteHelper | String
def render
div class: "-ml-4 -mt-2 flex items-center justify-between flex-wrap sm:flex-no-wrap" do
div class: "ml-4 mt-2" do
h3 class: "text-lg leading-6 font-medium text-gray-900" do
text title
end
end
div class: "ml-4 mt-2 flex-shrink-0" do
span class: "inline-flex rounded-md shadow-sm" do
link link_text, to: link_target, class: "a lot of classes"
end
end
end
end
end
web | 15 | link link_text, to: link_target, class: "a lot of classes"
web | ^---
web | Error: no overload matches 'UI::CardActionHeader#link' with types String, to: (Lucky::Action.class | Lucky::RouteHelper | String), class: String
web |
web | Overloads are:
web | - Lucky::LinkHelpers#link(text, to : Lucky::RouteHelper, attrs : Array(Symbol) = [] of Symbol, **html_options)
web | - Lucky::LinkHelpers#link(text, to : Lucky::Action.class, attrs : Array(Symbol) = [] of Symbol, **html_options)
web | - Lucky::LinkHelpers#link(to : Lucky::RouteHelper, attrs : Array(Symbol) = [] of Symbol, **html_options, &block)
web | - Lucky::LinkHelpers#link(to : Lucky::Action.class, attrs : Array(Symbol) = [] of Symbol, **html_options, &block)
web | - Lucky::LinkHelpers#link(to : Lucky::RouteHelper, attrs : Array(Symbol) = [] of Symbol, **html_options)
web | - Lucky::LinkHelpers#link(to : Lucky::Action.class, attrs : Array(Symbol) = [] of Symbol, **html_options)
web | - Lucky::LinkHelpers#link(text, to : String, attrs : Array(Symbol) = [] of Symbol, **html_options)
web | - Lucky::LinkHelpers#link(to : String, attrs : Array(Symbol) = [] of Symbol, **html_options, &block)
Shared::Field
. This allows you to pass any option you want and use other methods like a
or button
instead of link
. But I haven't test yet so not sure. Might be worth exploring. Looking forward to seeing what you came up with @stephendolan!
with_defaults
and that seems to work pretty well!
Button
component to share common classes
<a class="btn" href="#">Test</a>
, rather than <button class="btn"><a href="#">Test</a></button>