From 8abbdea80844ba5fd2f24cc8e10a3f5ff5c1286b Mon Sep 17 00:00:00 2001 From: Arthur Green Date: Wed, 18 Oct 2023 09:39:51 +0400 Subject: [PATCH] docs: fix form stories (#20) --- src/components/button/index.ts | 2 +- .../{Form.stories.ts => Form.stories.tsx} | 22 +++++++++++++++---- src/components/form/index.ts | 2 +- src/components/input/index.ts | 2 +- src/pages/sign-in/SignIn.tsx | 6 ++--- 5 files changed, 24 insertions(+), 10 deletions(-) rename src/components/form/{Form.stories.ts => Form.stories.tsx} (52%) diff --git a/src/components/button/index.ts b/src/components/button/index.ts index fe9c53c..3fa135d 100644 --- a/src/components/button/index.ts +++ b/src/components/button/index.ts @@ -1 +1 @@ -export { Button } from './Button'; +export { Button as default } from './Button'; diff --git a/src/components/form/Form.stories.ts b/src/components/form/Form.stories.tsx similarity index 52% rename from src/components/form/Form.stories.ts rename to src/components/form/Form.stories.tsx index 92af9ce..cd89301 100644 --- a/src/components/form/Form.stories.ts +++ b/src/components/form/Form.stories.tsx @@ -1,6 +1,10 @@ import type { Meta, StoryObj } from '@storybook/react'; import { Form } from './Form'; +import Input from '@/components/input'; + +import { Primary, Medium } from '@/components/input/Input.stories'; +// import * as ButtonStories from '@/components/button/Button.stories'; const meta = { title: 'Form', @@ -14,10 +18,20 @@ const meta = { } satisfies Meta; export default meta; -type Story = StoryObj; +type Story = StoryObj; -export const LoggedIn: Story = { - args: {}, +const FormTemplate: Story = { + render: ({ ...args }) => { + return ( +
+ + +
+ ); + }, }; -export const LoggedOut: Story = {}; +export const Login: Story = { + ...FormTemplate, + args: {}, +}; diff --git a/src/components/form/index.ts b/src/components/form/index.ts index d39070f..ccb7ded 100644 --- a/src/components/form/index.ts +++ b/src/components/form/index.ts @@ -1 +1 @@ -export { Form } from './Form'; +export { Form as default } from './Form'; diff --git a/src/components/input/index.ts b/src/components/input/index.ts index 6322cf3..b12ba42 100644 --- a/src/components/input/index.ts +++ b/src/components/input/index.ts @@ -1 +1 @@ -export { Input } from './Input'; +export { Input as default } from './Input'; diff --git a/src/pages/sign-in/SignIn.tsx b/src/pages/sign-in/SignIn.tsx index adbc17b..57d7180 100644 --- a/src/pages/sign-in/SignIn.tsx +++ b/src/pages/sign-in/SignIn.tsx @@ -1,8 +1,8 @@ import { Route } from '@tanstack/react-router'; -import { Form } from '@/components/form'; -import { Input } from '@/components/input'; -import { Button } from '@/components/button'; +import Form from '@/components/form'; +import Input from '@/components/input'; +import Button from '@/components/button'; import { rootRoute } from '@/pages/__root'; export const SignInPage = () => {