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 +4 -4
- data/README.md +16 -12
- data/lib/generators/storybook/install_generator.rb +4 -0
- data/lib/storybook/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f335ab6fd4c17cdfe41dff2a7b58d500339ffa527597b1e6cdc1bed0ceef79d3
|
4
|
+
data.tar.gz: f33691c20f2034b08d7ad033bee24b41be4a60f03653fd486c88683ad1bf40e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
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: ["
|
data/lib/storybook/version.rb
CHANGED