Skip to content

Instantly share code, notes, and snippets.

@paulcsmith
Last active August 17, 2020 14:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulcsmith/180bf202509b926c914e92bd137700de to your computer and use it in GitHub Desktop.
Save paulcsmith/180bf202509b926c914e92bd137700de to your computer and use it in GitHub Desktop.
class Button < BaseComponent
def render
with_defaults class: "my-btn" do |link_builder|
yield link_builder
end
end
end
m Button, &.link("Home", Home::Index)
class UI::CardActionHeader < BaseComponent
needs title : String
needs actions : Proc(Void)
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
actions.call
end
end
end
end
end
m UI::CardActionHeader, text: "My Title", actions: ->{m Button, &.link("Hello", Home::Index)}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment