import { Meta, StoryObj } from "@storybook/react";
import { FormatDuration } from ".";
export default {
title: "Format/FormatDuration",
component: FormatDuration,
parameters: {
layout: "centered",
},
decorators: [
(Story) => (
),
],
argTypes: {
value: {
control: "number",
},
minUnit: {
control: "select",
options: ["second", "minute", "hour", "day", "week", "month", "year"],
},
maxUnit: {
control: "select",
options: ["second", "minute", "hour", "day", "week", "month", "year"],
},
fallback: {
control: "text",
},
style: {
control: "select",
options: ["long", "short", "narrow"],
},
},
} as Meta;
type Story = StoryObj;
export const Primary: Story = {
args: {
value: 3892,
},
};
export const NoDuration: Story = {
args: {
value: null,
fallback: "No duration",
},
};
export const CustomizeRender: Story = {
args: {
...Primary.args,
children: (value) => Duration: {value}
,
},
parameters: {
docs: {
source: {
code: `
{(value) => Duration: {value}
}
`,
},
},
},
};