Menu
render Link.new(href: "#") { "Read more" }
Add the component to your project
Run the following command in your terminal
bundle exec essence add link
Copy and paste the following code into your project
# frozen_string_literal: true
class Components::Link < Components::Essence
attr_reader :kind
def initialize(kind: :regular, **attributes)
@kind = kind
super(**attributes)
end
def view_template(&)
a(**attributes, &)
end
private
def component_classes
{
_: {
_: "inline-flex w-fit items-center gap-1 font-medium text-gray-900 border-b-2 hover:border-gray-900 transition-colors",
kind: {
regular: "border-transparent",
underline: "border-gray-200"
}
}
}.freeze
end
end