Skip to content

Commit

Permalink
Shim for rendering partials
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholas Barone committed Aug 10, 2024
1 parent 58f9dd2 commit a6a4f01
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/storybook.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require "storybook/version"
require "storybook/preview"
require "storybook/partial_preview_component"
require "storybook/railtie" if defined?(Rails::Railtie)

module Storybook; end
13 changes: 13 additions & 0 deletions lib/storybook/partial_preview_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require 'view_component'

module Storybook
class PartialPreviewComponent < ViewComponent::Base
slim_template <<~SLIM
= render partial: @partial
SLIM

def initialize(partial:)
@partial = partial
end
end
end

0 comments on commit a6a4f01

Please sign in to comment.