import * as React from "react" import { storiesOf } from "@storybook/react" import * as common from "jamplay-common/client" import { theme } from "../../.." import BookReview from ".." import { bookReview } from "./mock.data" import ReviewSummary from "../ReviewSummary" import { RatingStarInput } from "../RatingStarInput" import ReviewItemInList from "../ReviewItemInList.component" import ReviewList from "../ReviewList.component" import ConfirmDeleteReviewDialog from "../ConfirmDeleteReviewDialog.component" import { action } from "@storybook/addon-actions" const providerOptions = { theme, } let x = 0 export const getReview = () => ( { _id: ++x + "", rating: 4, review: "1234", isOwner: false, createdAt: new Date(Date.now() - 3 * 60 * 1000).toISOString(), user: { _id: "1", name: "art2", profilePicture: null, }, } ) const manyReviews = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1].map(getReview) const reviews = [ { _id: "1", rating: 3, review: "1234", isOwner: false, createdAt: new Date(Date.now() - 3 * 60 * 1000).toISOString(), user: { _id: "1", name: "art", profilePicture: null, }, }, { _id: "2", rating: 4, review: "1234", isOwner: true, createdAt: new Date(Date.now() - 3 * 60 * 1000).toISOString(), user: { _id: "1", name: "art2", profilePicture: null, }, }, ] @common.provider(providerOptions) class Provider extends React.Component { public render() { return this.props.children } } storiesOf("Review", module) .addDecorator((story) => {story()}) .add("Book have reviews less than 3", () => ( )) .add("Book have reviews", () => ( )) .add("Book dont have review", () => ( )) .add("Rating star input ", () => { return }) .add("Rating star input with value ", () => { return }) .add("Book review Rating Indicator", () => { return (
) }) .add("Book review Rating Indicator--disabled-form", () => { return (
) }) .add("BookReviewItemInList", () => { return (
) }) .add("BookReviewItemInList--placeholder", () => { return (
) }) .add("BookReviewItemInList--isOwner", () => { return (
) }) .add("BookReviewList", () => { return (
) }) .add("BookReviewList--loading", () => { return (
) }) .add("BookReviewList--loading-with-data", () => { return (
) }) .add("BookReviewList--load-more", () => { return (
) }) .add("BookReviewList--no-load-more-if-loading", () => { return (
) }) .add("ConfirmDeleteReviewDialog", () => { return ( ) })