rails-storybook 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 458c8b46779f2ff4f95162603bbef83351fa665f74abb0ad05c964c001695807
4
- data.tar.gz: aabbc888656b99c56c3d1bb337c8291d7dec9497ca0ed00724c01977f3bc1dbb
3
+ metadata.gz: f335ab6fd4c17cdfe41dff2a7b58d500339ffa527597b1e6cdc1bed0ceef79d3
4
+ data.tar.gz: f33691c20f2034b08d7ad033bee24b41be4a60f03653fd486c88683ad1bf40e6
5
5
  SHA512:
6
- metadata.gz: fb49d7e4d163b9ce723dfaa28c9fa22d67c53279e5364ba86af01e895a3059f526af125f427e95c4ab5b18674beb7f1c654031981de62219e24ea759f97fd8df
7
- data.tar.gz: e8892db80deae244450745ed86ca751731f9d62c2e51905ad12a80593c840fbdab1a55111a3ba92e63f5177fc0d5dbbc29e2dbb6d9814f3ca5e36a89becd301b
6
+ metadata.gz: 7567546c11d94c6c967175dd8580b6575c5193fa15dd231f6c015dbd21c43b721c3960abd1c90b6e2e997d450286a87772efacc858e57135f7a4297baaafffa2
7
+ data.tar.gz: 7442f5ab8ad9a58294f854e898550a12d9b54d00bf3e66ba854771e032a9e8eef5657a10c0b63f7e9061961b19a6c29bcc5ac530c56101da99b72efde4afb52b
data/README.md CHANGED
@@ -28,25 +28,29 @@ Restart your processes (stop and restart `./bin/dev`) and viola! Opens up a Stor
28
28
 
29
29
  ## Usage
30
30
 
31
- Write a preview for your component, just like normal - but include the StoryBook::Preview module. You can also use the `PartialPreviewComponent` to render regular Rails partials as previews.
31
+ Write [rails-previews](https://github.com/rangerscience/rails-previews) for your partials, view components, and react-on-rails components -
32
+
32
33
  ```ruby
33
- class ExampleComponentPreview < ViewComponent::Preview
34
- include Storybook::Preview
35
- def default
36
- render(ExampleComponent.new(title: "title"))
37
- end
38
-
39
- def default
40
- render(PartialPreviewComponent.new(partial: "application/example"))
34
+ module Previews
35
+ class Example < Rails::Previews::Preview
36
+ def partial
37
+ render_partial "application/example", title: "Hello, World!"
38
+ end
39
+
40
+ def view_component
41
+ ExampleComponent.new(title: "Hello, World!")
42
+ end
43
+
44
+ def react_component
45
+ render_react_on_rails "HelloWorld", name: "Hello, World!"
46
+ end
41
47
  end
42
48
  end
43
49
  ```
44
- Note that the module will set the preview's layout to `storybook`, as there's steps to be done to make it look good (and work!) inside of Storybook.
45
50
 
46
51
  Then run `rake storybook:stories` to generate the CSF JSON that Storybook uses to find your previews.
47
52
 
48
- And... that's it! :D
49
-
53
+ And... that's it! :D Just turn on Storybook to see your examples :)
50
54
 
51
55
  ## Development
52
56
 
@@ -23,6 +23,10 @@ class Storybook::InstallGenerator < Rails::Generators::Base
23
23
  RUBY
24
24
  end
25
25
 
26
+ def mount_previews
27
+ insert_into_file "config/routes.rb", " mount Rails::Previews::Engine => \"/previews\"\n", after: "Rails.application.routes.draw do\n"
28
+ end
29
+
26
30
  def update_storybook
27
31
  # Main.js
28
32
  insert_into_file ".storybook/main.js", "\n \"@storybook/server\",", after: "addons: ["
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Storybook
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.1"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-storybook
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicholas Barone