Simplify stories

Signed-off-by: Charles de Dreuille <charles.dedreuille@gmail.com>
This commit is contained in:
Charles de Dreuille
2024-12-30 18:09:08 +01:00
parent d9b0d59b2e
commit b9a2357185
19 changed files with 35 additions and 301 deletions
@@ -21,7 +21,7 @@ import { Stack } from '../Stack';
import { Inline } from '../Inline';
const meta = {
title: 'Components/Box',
title: 'Box',
component: Box,
parameters: {
layout: 'centered',
@@ -21,7 +21,7 @@ import { Inline } from '../Inline';
import { Stack } from '../Stack';
const meta = {
title: 'Components/Button',
title: 'Button',
component: Button,
parameters: {
layout: 'centered',
@@ -18,7 +18,7 @@ import type { Meta, StoryObj } from '@storybook/react';
import { Checkbox } from './Checkbox';
const meta = {
title: 'Components/Checkbox',
title: 'Checkbox',
component: Checkbox,
parameters: {
layout: 'centered',
@@ -20,7 +20,7 @@ import { Box } from '../Box/Box';
import { Container } from './Container';
const meta = {
title: 'Components/Container',
title: 'Container',
component: Container,
argTypes: {
children: {
@@ -22,7 +22,7 @@ import { Box } from '../Box/Box';
import { Stack } from '../Stack';
const meta = {
title: 'Components/Grid',
title: 'Grid',
component: Grid,
argTypes: {
children: {
@@ -20,7 +20,7 @@ import { Heading } from './Heading';
import { Stack } from '../Stack';
const meta = {
title: 'Components/Heading',
title: 'Heading',
component: Heading,
} satisfies Meta<typeof Heading>;
@@ -21,7 +21,7 @@ import { CanonProvider } from '../../contexts/canon';
import { icons } from './icons';
const meta = {
title: 'Components/Icon',
title: 'Icon',
component: Icon,
parameters: {
layout: 'centered',
@@ -20,7 +20,7 @@ import { Inline } from './Inline';
import { Box } from '../Box/Box';
const meta = {
title: 'Components/Inline',
title: 'Inline',
component: Inline,
argTypes: {
align: {
@@ -20,7 +20,7 @@ import { Stack } from './Stack';
import { Box } from '../Box/Box';
const meta = {
title: 'Components/Stack',
title: 'Stack',
component: Stack,
argTypes: {
align: {
@@ -14,23 +14,6 @@
* limitations under the License.
*/
import * as React from 'react';
import type { Meta, StoryObj } from '@storybook/react';
import {
Table,
TableHead,
TableRow,
TableHeader,
TableCell,
TableBody,
TableFooter,
} from '../Table';
const meta = {
title: 'Components/Table/Examples/Simple',
component: Table,
} satisfies Meta<typeof Table>;
const invoices = [
{
invoice: 'INV001',
@@ -76,6 +59,31 @@ const invoices = [
},
];
import React from 'react';
import type { Meta, StoryObj } from '@storybook/react';
import {
Table,
TableBody,
TableCell,
TableFooter,
TableHead,
TableHeader,
TableRow,
} from '../Table';
const meta = {
title: 'Table',
component: Table,
subcomponents: {
TableBody: TableBody as React.ComponentType<unknown>,
TableCell: TableCell as React.ComponentType<unknown>,
TableFooter: TableFooter as React.ComponentType<unknown>,
TableHead: TableHead as React.ComponentType<unknown>,
TableHeader: TableHeader as React.ComponentType<unknown>,
TableRow: TableRow as React.ComponentType<unknown>,
},
} satisfies Meta<typeof Table>;
export default meta;
type Story = StoryObj<typeof meta>;
@@ -1,32 +0,0 @@
/*
* Copyright 2024 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import type { Meta, StoryObj } from '@storybook/react';
import { Table } from '../Table';
const meta = {
title: 'Components/Table/Components/Table',
component: Table,
} satisfies Meta<typeof Table>;
export default meta;
type Story = StoryObj<typeof meta>;
export const Default: Story = {
args: {
children: "Hello World! I'm a basic table",
},
};
@@ -1,40 +0,0 @@
/*
* Copyright 2024 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as React from 'react';
import type { Meta, StoryObj } from '@storybook/react';
import { Table, TableBody } from '../Table';
const meta = {
title: 'Components/Table/Components/TableBody',
component: TableBody,
decorators: [
Story => (
<Table>
<Story />
</Table>
),
],
} satisfies Meta<typeof TableBody>;
export default meta;
type Story = StoryObj<typeof meta>;
export const Default: Story = {
args: {
children: "Hello World! I'm a basic table body",
},
};
@@ -1,30 +0,0 @@
/*
* Copyright 2024 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import type { Meta, StoryObj } from '@storybook/react';
import { TableCaption } from '../Table';
const meta = {
title: 'Components/Table/Components/TableCaption',
component: TableCaption,
} satisfies Meta<typeof TableCaption>;
export default meta;
type Story = StoryObj<typeof meta>;
export const Default: Story = {
args: {},
};
@@ -1,30 +0,0 @@
/*
* Copyright 2024 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import type { Meta, StoryObj } from '@storybook/react';
import { TableCell } from '../Table';
const meta = {
title: 'Components/Table/Components/TableCell',
component: TableCell,
} satisfies Meta<typeof TableCell>;
export default meta;
type Story = StoryObj<typeof meta>;
export const Default: Story = {
args: {},
};
@@ -1,30 +0,0 @@
/*
* Copyright 2024 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import type { Meta, StoryObj } from '@storybook/react';
import { TableFooter } from '../Table';
const meta = {
title: 'Components/Table/Components/TableFooter',
component: TableFooter,
} satisfies Meta<typeof TableFooter>;
export default meta;
type Story = StoryObj<typeof meta>;
export const Default: Story = {
args: {},
};
@@ -1,30 +0,0 @@
/*
* Copyright 2024 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import type { Meta, StoryObj } from '@storybook/react';
import { TableHead } from '../Table';
const meta = {
title: 'Components/Table/Components/TableHead',
component: TableHead,
} satisfies Meta<typeof TableHead>;
export default meta;
type Story = StoryObj<typeof meta>;
export const Default: Story = {
args: {},
};
@@ -1,40 +0,0 @@
/*
* Copyright 2024 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as React from 'react';
import type { Meta, StoryObj } from '@storybook/react';
import { Table, TableHeader } from '../Table';
const meta = {
title: 'Components/Table/Components/TableHeader',
component: TableHeader,
decorators: [
Story => (
<Table>
<Story />
</Table>
),
],
} satisfies Meta<typeof TableHeader>;
export default meta;
type Story = StoryObj<typeof meta>;
export const Default: Story = {
args: {
children: "Hello World! I'm a basic table header",
},
};
@@ -1,42 +0,0 @@
/*
* Copyright 2024 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as React from 'react';
import type { Meta, StoryObj } from '@storybook/react';
import { Table, TableRow, TableHeader } from '../Table';
const meta = {
title: 'Components/Table/Components/TableRow',
component: TableRow,
decorators: [
Story => (
<Table>
<TableHeader>
<Story />
</TableHeader>
</Table>
),
],
} satisfies Meta<typeof TableRow>;
export default meta;
type Story = StoryObj<typeof meta>;
export const Default: Story = {
args: {
children: "Hello World! I'm a basic table row",
},
};
@@ -20,7 +20,7 @@ import { Text } from './Text';
import { Stack } from '../Stack';
const meta = {
title: 'Components/Text',
title: 'Text',
component: Text,
} satisfies Meta<typeof Text>;