Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some assorted Phlex support sketches #36

Open
kaspth opened this issue Feb 20, 2023 · 1 comment
Open

Some assorted Phlex support sketches #36

kaspth opened this issue Feb 20, 2023 · 1 comment

Comments

@kaspth
Copy link
Collaborator

kaspth commented Feb 20, 2023

"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
@kaspth
Copy link
Collaborator Author

kaspth commented Feb 25, 2023

Just to be clear: we do support Phlex out of the box already, users will just have to write their Showcase previews in ERB. This is about passing control to Phlex so users can write that directly, possibly in app/views/showcase/previews/x.rb files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant