Skip to content

Commit

Permalink
V1 api (#151)
Browse files Browse the repository at this point in the history
Add v1 API as discussed in #150
  • Loading branch information
jonspalmer authored Jan 7, 2023
1 parent 7793928 commit 2781fb4
Show file tree
Hide file tree
Showing 101 changed files with 1,498 additions and 3,570 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
rails_version: [6.0.6, 6.1.7, 7.0.4, main]
rails_version: [6.0.6, 6.1.7, 7.0.4]
ruby_version: [2.6.10, 2.7.7, 3.0.5, 3.1.3]
exclude:
- rails_version: 6.0.6
Expand All @@ -36,8 +36,8 @@ jobs:
ruby_version: 2.5.9
- rails_version: 7.0.4
ruby_version: 2.6.10
- rails_version: main
ruby_version: 2.6.10
# - rails_version: main
# ruby_version: 2.6.10
steps:
- uses: actions/checkout@master
- name: Setup Ruby
Expand Down
10 changes: 7 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
PATH
remote: .
specs:
view_component_storybook (0.12.1)
view_component-storybook (1.0.0)
view_component (>= 2.54)
yard (~> 0.9.25)

GEM
remote: https://rubygems.org/
Expand Down Expand Up @@ -185,7 +186,7 @@ GEM
rspec-mocks (~> 3.10)
rspec-support (~> 3.10)
rspec-support (3.12.0)
rubocop (1.40.0)
rubocop (1.41.1)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 3.1.2.1)
Expand Down Expand Up @@ -232,11 +233,14 @@ GEM
activesupport (>= 5.2.0, < 8.0)
concurrent-ruby (~> 1.0)
method_source (~> 1.0)
webrick (1.7.0)
websocket-driver (0.7.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
xpath (3.2.0)
nokogiri (~> 1.8)
yard (0.9.28)
webrick (~> 1.7.0)
zeitwerk (2.6.6)

PLATFORMS
Expand All @@ -257,7 +261,7 @@ DEPENDENCIES
simplecov (~> 0.21.2)
simplecov-console (~> 0.9)
sprockets-rails (~> 3.4.2)
view_component_storybook!
view_component-storybook!

BUNDLED WITH
2.3.26
46 changes: 0 additions & 46 deletions app/controllers/view_component/storybook/stories_controller.rb

This file was deleted.

8 changes: 0 additions & 8 deletions app/views/view_component/storybook/stories/show.html.erb

This file was deleted.

32 changes: 0 additions & 32 deletions config/locales/en.yml

This file was deleted.

6 changes: 3 additions & 3 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Last 0.x release
* Klazz Control
* Deprecated Controls DSL
* Add support for Object Controls with array values
* Remove ArrayConfig - array aliases ObjectConfig
* Remove ArrayConfig - array aliases Object
* Updated Options Control to match Storybook 6.2 syntax
* `options` as array
* add `labels` option
Expand All @@ -64,6 +64,6 @@ Last 0.x release

## 0.7.0

* Add inclusion validation to NumberConfig type
* Support ObjectConfigs with nested values
* Add inclusion validation to Number type
* Support Objects with nested values
* Support nil control values
10 changes: 6 additions & 4 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ FOr local development this is typically:
// .storybook/preview.js
export const parameters = {
server: {
url: `http://localhost:3000/rails/stories`,
url: `http://localhost:3000/rails/view_components`,
},
};
```
Expand All @@ -27,20 +27,22 @@ Story classes live in `test/components/stories`, which can be configured using t

```ruby
# config/application.rb
config.view_component_storybook.stories_path = Rails.root.join("spec/components/stories")
config.view_component_storybook.stories_paths << Rails.root.join("spec/components/stories")
```

## Stories Route

Stories are served from <http://localhost:3000/rails/stories> by default. To use a different endpoint, set the `stories_route` option:
Stories are served from the same route as ViewComponent previews <http://localhost:3000/rails/view_components> by default. To use a different endpoint, set the ViewComponent `previews_route` option:

```ruby
# config/application.rb
config.view_component_storybook.stories_route = "/stories"
config.view_component.preview_route = "/stories"
```

This example will make the previews available from <http://localhost:3000/stories>.

For more details see the [ViewCompontent `preview_route` documentation](https://viewcomponent.org/api.html#preview_route--string)

## Stories Title Generation

You may wish to customize how the title of stories are generated, this can be done by setting a custom `stories_title_generator` lambda function:
Expand Down
75 changes: 0 additions & 75 deletions docs/guide/constructor.md

This file was deleted.

Loading

0 comments on commit 2781fb4

Please sign in to comment.