import { Meta } from "@storybook/react"
import React from "react"
import { useCartShippingOptions, useShippingOptions } from "../src"
import Layout from "./components/Layout"
const ShippingOptions = ({ showHookData, cartId }) => {
const data = useShippingOptions(cartId)
return (
Shipping Options
{data?.shipping_options?.map((so) => (
-
{so.name} - {so.amount}
))}
)
}
const CartShippingOptions = ({ showHookData, cartId }) => {
const data = useCartShippingOptions(cartId)
return (
Cart shipping options: {cartId}
{data?.shipping_options?.map((so) => (
-
{so.name} - {so.amount}
))}
)
}
const meta: Meta = {
title: "Shipping Options",
argTypes: {
showHookData: {
name: "Show hook data",
description:
"Whether or not story should display JSON of data returned from hook",
control: {
type: "boolean",
},
defaultValue: true,
},
},
parameters: {
controls: { expanded: true },
},
}
export default meta
export const List = (args: { showHookData: boolean; cartId: string }) => (
)
List.argTypes = {
cartId: {
control: {
type: "text",
},
name: "cart id",
defaultValue: "cart_...",
},
}
export const GetOne = (args: { showHookData: boolean; cartId: string }) => (
)
GetOne.argTypes = {
cartId: {
control: {
type: "text",
},
name: "cart id",
defaultValue: "cart_...",
},
}