Module: Playbook::PbKitHelper

Defined in:
app/helpers/playbook/pb_kit_helper.rb

Instance Method Summary collapse

Instance Method Details

#pb_rails(kit, props: {}, &block) ⇒ Object



10
11
12
13
14
15
16
17
# File 'app/helpers/playbook/pb_kit_helper.rb', line 10

def pb_rails(kit, props: {}, &block)
  previous = prefix_partial_path_with_controller_namespace
  self.prefix_partial_path_with_controller_namespace = false
  kit = build_view_model(kit.to_s, rails_props(props), &block)
  render(partial: kit, as: :object)
ensure
  self.prefix_partial_path_with_controller_namespace = previous
end

#pb_react(kit, props: {dark: react_props}, options: {}) ⇒ Object



19
20
21
# File 'app/helpers/playbook/pb_kit_helper.rb', line 19

def pb_react(kit, props:{dark: react_props}, options: {})
  ::Webpacker::React::Component.new(kit.camelize).render(props, options)
end