diff --git a/packages/docs/.storybook/main.js b/packages/docs/.storybook/main.js index 3a3fe88..06d2314 100644 --- a/packages/docs/.storybook/main.js +++ b/packages/docs/.storybook/main.js @@ -1,7 +1,7 @@ module.exports = { "stories": [ - "../stories/**/*.stories.mdx", - "../stories/**/*.stories.@(js|jsx|ts|tsx)" + "../src/stories/**/*.stories.mdx", + "../src/stories/**/*.stories.@(js|jsx|ts|tsx)" ], "addons": [ "@storybook/addon-links", diff --git a/packages/docs/package.json b/packages/docs/package.json index ae97a69..4a03369 100644 --- a/packages/docs/package.json +++ b/packages/docs/package.json @@ -17,6 +17,9 @@ "vite": "^4.0.0" }, "dependencies": { + "@ignite-ui/react": "*", + "@ignite-ui/tokens": "*", + "@ignite-ui/eslint-config": "*", "react": "^18.2.0", "react-dom": "^18.2.0" }, diff --git a/packages/docs/src/stories/Button.stories.tsx b/packages/docs/src/stories/Button.stories.tsx new file mode 100644 index 0000000..4f24ed0 --- /dev/null +++ b/packages/docs/src/stories/Button.stories.tsx @@ -0,0 +1,18 @@ +import { StoryObj, Meta } from '@storybook/react'; +import { Button, ButtonProps } from '@ignite-ui/react'; + +export default { + title: 'Button', + component: Button, + args: { + children: 'Button', + }, +} as Meta; + +export const Primary: StoryObj = {}; + +export const Large: StoryObj = { + args: { + size: 'large', + }, +}; diff --git a/packages/docs/stories/Button.jsx b/packages/docs/stories/Button.jsx deleted file mode 100644 index 15dde39..0000000 --- a/packages/docs/stories/Button.jsx +++ /dev/null @@ -1,50 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import './button.css'; - -/** - * Primary UI component for user interaction - */ -export const Button = ({ primary, backgroundColor, size, label, ...props }) => { - const mode = primary ? 'storybook-button--primary' : 'storybook-button--secondary'; - return ( - - ); -}; - -Button.propTypes = { - /** - * Is this the principal call to action on the page? - */ - primary: PropTypes.bool, - /** - * What background color to use - */ - backgroundColor: PropTypes.string, - /** - * How large should the button be? - */ - size: PropTypes.oneOf(['small', 'medium', 'large']), - /** - * Button contents - */ - label: PropTypes.string.isRequired, - /** - * Optional click handler - */ - onClick: PropTypes.func, -}; - -Button.defaultProps = { - backgroundColor: null, - primary: false, - size: 'medium', - onClick: undefined, -}; diff --git a/packages/docs/stories/Button.stories.jsx b/packages/docs/stories/Button.stories.jsx deleted file mode 100644 index 61f6e19..0000000 --- a/packages/docs/stories/Button.stories.jsx +++ /dev/null @@ -1,40 +0,0 @@ -import React from 'react'; - -import { Button } from './Button'; - -// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export -export default { - title: 'Example/Button', - component: Button, - // More on argTypes: https://storybook.js.org/docs/react/api/argtypes - argTypes: { - backgroundColor: { control: 'color' }, - }, -}; - -// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args -const Template = (args) => -} + '&:hover': { + backgroundColor: '$ignite500', + }, + + variants: { + size: { + small: { + fontSize: '$sm', + padding: '$2 $4', + }, + large: { + fontSize: '$md', + padding: '$3 $6', + }, + }, + }, + + defaultVariants: { + size: 'small', + }, +}); + +export type ButtonProps = ComponentProps;