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

Websocket fails to connect when Lookbook is mounted at root #4

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ gem 'jbuilder', '~> 2.7'
gem 'bootsnap', '>= 1.4.4', require: false

gem "view_component"
gem "lookbook"
gem "lookbook", "0.6.1"


group :development, :test do
Expand Down
9 changes: 5 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,11 @@ GEM
loofah (2.13.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
lookbook (0.5.0)
lookbook (0.6.1)
actioncable
htmlbeautifier (~> 1.3)
listen (~> 3.0)
rails (>= 5.0)
railties (>= 5.0)
redcarpet (~> 3.5)
rouge (~> 3.26)
view_component (~> 2.0)
Expand Down Expand Up @@ -161,7 +162,7 @@ GEM
redcarpet (3.5.1)
regexp_parser (2.2.0)
rexml (3.2.5)
rouge (3.27.0)
rouge (3.28.0)
rubyzip (2.3.2)
selenium-webdriver (4.1.0)
childprocess (>= 0.5, < 5.0)
Expand Down Expand Up @@ -218,7 +219,7 @@ DEPENDENCIES
capybara (>= 3.26)
jbuilder (~> 2.7)
listen (~> 3.3)
lookbook
lookbook (= 0.6.1)
pg
puma (~> 5.0)
rack-mini-profiler (~> 2.0)
Expand Down
15 changes: 15 additions & 0 deletions app/components/elements/list_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class Elements::ListComponent < ViewComponent::Base
renders_many :items, "ItemComponent"

def call
tag.ol do
safe_join items
end
end

class ItemComponent < ViewComponent::Base
def call
tag.li content
end
end
end
4 changes: 2 additions & 2 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Rails.application.routes.draw do
root "demo#index"
mount Lookbook::Engine, at: "/lookbook"
# root "demo#index"
mount Lookbook::Engine, at: "/"
end
13 changes: 13 additions & 0 deletions test/components/previews/elements/list_component_preview.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# @label Simple list
class Elements::ListComponentPreview < ViewComponent::Preview
# This example uses the `with_content` helper to set inline content.
#
# You can read more about it in the ViewComponent [slots documentation](https://viewcomponent.org/guide/slots.html#with_content).
def default
render Elements::ListComponent.new do |list|
list.item.with_content "One"
list.item.with_content "Two"
list.item.with_content "Three"
end
end
end