showcase
showcase copied to clipboard
Some assorted Phlex support sketches
"showcase/previews/#{path.id}".classify
"Showcase::Previews::Box".constantize.render_in(@view_context)
# Require Zeitwerk naming conventions so `constantize` works.
# showcase/previews/box.rb
class Showcase::Previews::Box < Showcase::Phlex::Preview
def template
description do
end
sample "Basic" do
end
end
end
showcase.sample "Basic" do
render Phlex::View
end
class Showcase::Phlex::Preview < Phlex::HTML
attr_reader :showcase
def initialize(showcase)
@showcase = showcase
end
def template
yield
end
end
preview = Showcase::Preview.new
Showcase::Phlex::Preview.new(self).render_in(@view_context)
Showcase.phlex do
end