Skip to content

Commit

Permalink
Merge pull request #391 from storyblok/feature/bridgeOptions-param-types
Browse files Browse the repository at this point in the history
Add bridgeOptions param in StoryblokStory & README
  • Loading branch information
schabibi1 authored Aug 21, 2023
2 parents ec5a39a + edebe36 commit 27a6752
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,17 @@ Use `<StoryblokStory />` to get the new story every time is triggered a `change`

#### 2. Link your components to Storyblok Visual Editor

`<StoryblokStory />` keeps the state for the story behind the scenes and uses `StoryblokComponent` to render the route components dynamically, using the list of components loaded during the initialization inside the storyblokInit function. You can use the `StoryblokComponent` inside the components to redner the nested components dynamically.
`<StoryblokStory />` keeps the state for the story behind the scenes and uses `StoryblokComponent` to render the route components dynamically, using the list of components loaded during the initialization inside the storyblokInit function. You can use the `StoryblokComponent` inside the components to redner the nested components dynamically. You can also pass bridge options to `<StoryblokStory />` using the prop `bridgeOptions`.

```js
<StoryblokStory
story={data.story}
bridgeOptions={{
resolveRelations: ["Article.author"],
resolveLinks: "url",
preventClicks: true
}} />
```

For every component you've defined in your Storyblok space, call the `storyblokEditable` function with the blok content:

Expand Down
4 changes: 2 additions & 2 deletions lib/story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ interface StoryblokStoryProps {
}

const StoryblokStory = forwardRef<HTMLElement, StoryblokStoryProps>(
({ story, ...restProps }, ref) => {
story = useStoryblokState(story);
({ story, bridgeOptions, ...restProps }, ref) => {
story = useStoryblokState(story, bridgeOptions);
return <StoryblokComponent ref={ref} blok={story.content} {...restProps} />;
}
);
Expand Down

0 comments on commit 27a6752

Please sign in to comment.