Components

LoadMoreStoriesBase

<LoadMoreStoriesBase />

This component starts with a set of stories, and then provides a load more button. This calls out to /api/v1/stories with the properties passed via the params prop. The stories are concatenated with the stories in props.data.stories, and the contents of props.data are passed to the rendered template.

It can accept an alternate api as a prop as well as apiResponseTransformer which can be used to tranformer the api response before being passed to the template.

Example

import { LoadMoreStoriesBase } from '@quintype/components';

function SectionPageWithStories({section, stories, loading, onLoadMore, noMoreStories}) {
  return <div/>;
}

export function SectionPage(props) {
  return <LoadMoreStoriesBase template={SectionPageWithStories}
                              fields={"id,headline"}
                              {...props}
                              params={{"section-id": props.data.section.id}}
                              api="/api/v1/stories"
                              apiResponseTransformer={(response) => response.stories} />
}

Also see LoadMoreCollectionStories for a version that takes a collection