diff --git a/apps/storybook/.eslintrc.js b/apps/storybook/.eslintrc.js index 97e05895..07b7f196 100644 --- a/apps/storybook/.eslintrc.js +++ b/apps/storybook/.eslintrc.js @@ -1,4 +1,8 @@ module.exports = { root: true, extends: ['tih'], + parserOptions: { + tsconfigRootDir: __dirname, + project: ['./tsconfig.json'], + }, }; diff --git a/apps/storybook/package.json b/apps/storybook/package.json index f4dffb22..df648014 100644 --- a/apps/storybook/package.json +++ b/apps/storybook/package.json @@ -7,6 +7,7 @@ "build": "build-storybook --docs", "preview-storybook": "serve storybook-static", "clean": "rm -rf .turbo && rm -rf node_modules", + "lint": "eslint stories/**/*.ts* --fix", "tsc": "tsc" }, "dependencies": { diff --git a/apps/storybook/stories/alert.stories.tsx b/apps/storybook/stories/alert.stories.tsx index d59de9bf..6cf0d425 100644 --- a/apps/storybook/stories/alert.stories.tsx +++ b/apps/storybook/stories/alert.stories.tsx @@ -1,6 +1,7 @@ -import { ComponentMeta } from '@storybook/react'; -import { Alert, AlertVariant } from '@tih/ui'; import React from 'react'; +import type { ComponentMeta } from '@storybook/react'; +import type { AlertVariant } from '@tih/ui'; +import { Alert } from '@tih/ui'; const alertVariants: ReadonlyArray = [ 'info', @@ -10,24 +11,24 @@ const alertVariants: ReadonlyArray = [ ]; export default { - title: 'Alert', - component: Alert, argTypes: { title: { control: 'text', }, variant: { - options: alertVariants, control: { type: 'select' }, + options: alertVariants, }, }, + component: Alert, + title: 'Alert', } as ComponentMeta; export const Basic = { args: { + children: 'This is something you should pay your full attention to.', title: 'Please pay attention', variant: 'info', - children: 'This is something you should pay your full attention to.', }, }; diff --git a/apps/storybook/stories/badge.stories.tsx b/apps/storybook/stories/badge.stories.tsx index 45c85639..9141d9e9 100644 --- a/apps/storybook/stories/badge.stories.tsx +++ b/apps/storybook/stories/badge.stories.tsx @@ -1,6 +1,7 @@ -import { ComponentMeta } from '@storybook/react'; -import { Badge, BadgeVariant } from '@tih/ui'; import React from 'react'; +import type { ComponentMeta } from '@storybook/react'; +import type { BadgeVariant } from '@tih/ui'; +import { Badge } from '@tih/ui'; const badgeVariants: ReadonlyArray = [ 'primary', @@ -11,14 +12,14 @@ const badgeVariants: ReadonlyArray = [ ]; export default { - title: 'Badge', - component: Badge, argTypes: { variant: { - options: badgeVariants, control: { type: 'select' }, + options: badgeVariants, }, }, + component: Badge, + title: 'Badge', } as ComponentMeta; export const Basic = { diff --git a/apps/storybook/stories/button.stories.tsx b/apps/storybook/stories/button.stories.tsx index 2aef9296..6aea4ee6 100644 --- a/apps/storybook/stories/button.stories.tsx +++ b/apps/storybook/stories/button.stories.tsx @@ -1,15 +1,15 @@ -import { ComponentMeta } from '@storybook/react'; - -import { - Button, +import React from 'react'; +import { EnvelopeIcon } from '@heroicons/react/24/solid'; +import type { ComponentMeta } from '@storybook/react'; +import type { ButtonAddOnPosition, ButtonDisplay, ButtonSize, ButtonType, - ButtonVariant, + ButtonVariant} from '@tih/ui'; +import { + Button } from '@tih/ui'; -import React from 'react'; -import { EnvelopeIcon } from '@heroicons/react/24/solid'; const buttonTypes: ReadonlyArray = ['button', 'reset', 'submit']; const buttonSizes: ReadonlyArray = ['sm', 'md', 'lg']; @@ -27,16 +27,14 @@ const buttonVariants: ReadonlyArray = [ ]; export default { - title: 'Button', - component: Button, argTypes: { addonPosition: { - options: buttonAddOnPositions, control: { type: 'select' }, + options: buttonAddOnPositions, }, display: { - options: buttonDisplays, control: { type: 'select' }, + options: buttonDisplays, }, isDisabled: { control: 'boolean', @@ -48,18 +46,20 @@ export default { control: 'text', }, size: { - options: buttonSizes, control: { type: 'select' }, + options: buttonSizes, }, type: { - options: buttonTypes, control: { type: 'select' }, + options: buttonTypes, }, variant: { - options: buttonVariants, control: { type: 'select' }, + options: buttonVariants, }, }, + component: Button, + title: 'Button', } as ComponentMeta; export const Basic = { @@ -111,8 +111,8 @@ export function Disabled() {
{buttonVariants.map((variant) => (