import React from 'react';
import type { Meta } from '@storybook/react-vite';
import { AmountFormat } from './AmountFormat';
import { DateFormat } from './DateFormat';
import { DurationFormat } from './DurationFormat';
import { EmptyPlaceholder } from './EmptyPlaceholder';
import { ErrorPlaceholder } from './ErrorPlaceholder';
import { NotReadyPlaceholder } from './NotReadyPlaceholder';
import { PhoneNumberFormat } from './PhoneNumberFormat';
import { TruncateFormat } from './TruncateFormat';
const meta: Meta = {
title: 'components/formats',
parameters: {
layout: 'fullscreen',
},
};
export default meta;
export const Default = () => {
const formatGroups = [
{
title: 'Placeholder Components',
description: 'Components for handling empty states, errors, and loading states',
items: [
{
title: 'EmptyPlaceholder',
children: [
{
description: 'default',
content: ,
},
],
},
{
title: 'ErrorPlaceholder',
children: [
{
description: 'string error',
content: ,
},
{
description: 'error object',
content: ,
},
],
},
{
title: 'NotReadyPlaceholder',
children: [
{
description: 'default',
content: ,
},
{
description: 'loading',
content: ,
},
{
description: 'error',
content: ,
},
{
description: 'empty',
content: ,
},
],
},
],
},
{
title: 'Data Format Components',
description: 'Components for formatting numbers, dates, durations, and other data types',
items: [
{
title: 'AmountFormat',
children: [
{
description: 'integer',
content: ,
},
{
description: 'decimal',
content: ,
},
{
description: 'large number',
content: ,
},
{
description: 'string number',
content: ,
},
{
description: 'undefined',
content: ,
},
],
},
{
title: 'DateFormat',
children: [
{
description: 'default (YYYY-MM-DD)',
content: ,
},
{
description: 'Chinese format',
content: ,
},
{
description: 'time only',
content: ,
},
{
description: 'ISO string input',
content: ,
},
{
description: 'current timestamp',
content: ,
},
{
description: 'invalid date',
content: ,
},
],
},
{
title: 'DurationFormat',
children: [
{
description: '1.5 seconds',
content: ,
},
{
description: '30 seconds',
content: ,
},
{
description: '1.5 minutes',
content: ,
},
{
description: '1h 1m 1s',
content: ,
},
{
description: 'undefined',
content: ,
},
],
},
],
},
{
title: 'Text & Communication Format Components',
description: 'Components for formatting text, phone numbers, and other communication data',
items: [
{
title: 'TruncateFormat',
children: [
{
description: 'short text',
content: abc,
},
{
description: 'long text',
content: abc def ghi jkl mno pqr stu vwx yz,
},
{
description: 'value prop',
content: ,
},
],
},
{
title: 'PhoneNumberFormat',
children: [
{
description: 'Chinese mobile',
content: ,
},
{
description: 'Chinese landline',
content: ,
},
{
description: 'US number',
content: ,
},
{
description: 'unmasked',
content: ,
},
{
description: 'empty',
content: ,
},
],
},
],
},
];
return (
{formatGroups.map((group, groupIndex) => (
{group.title}
{group.description}
{group.items.map((item, itemIndex) => (
{item.title}
{item.children.map((child, childIndex) => (
{child.description}
{child.content}
))}
))}
))}
);
};