The WithSeeMore HOC provides the UI and logic for a 'See More' link at the bottom of a story. It can be used within a custom content component.
Basic Usage
Wrap your custom content with WithSeeMore. It receives story and action props.
const { WithSeeMore } from 'react-insta-stories';
const CustomStoryContent = ({ story, action }) => {
return <WithSeeMore story={story} action={action}>
<div>
<h1>Hello!</h1>
<p>This story would have a 'See More' link at the bottom ✨</p>
</div>
</WithSeeMore>
}
Custom Collapsed State
Pass a customCollapsed prop to WithSeeMore to define what is shown when the 'See More' section is not expanded. The custom component receives toggleMore and action props.
const { WithSeeMore } from 'react-insta-stories';
const customCollapsedComponent = ({ toggleMore, action }) =>
<h2 onClick={() => {
action('pause');
window.open('https://mywebsite.url', '_blank');
}}>
Go to Website
</h2>
const CustomStoryContent = ({ story, action }) => {
return <WithSeeMore
story={story}
action={action}
customCollapsed={customCollapsedComponent}
>
<div>
<h1>Hello!</h1>
<p>This story would have a 'See More' link at the bottom and will open a URL in a new tab.</p>
</div>
</WithSeeMore>
}
Using via Story Object
You can also provide the components directly in the story object using seeMore and seeMoreCollapsed keys.