-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from aversini/storybook
docs: replacing custom documentation with StoryBook
- Loading branch information
Showing
22 changed files
with
7,046 additions
and
1,123 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
module.exports = { | ||
"*.{ts,js,tsx,jsx}": [ | ||
"eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0 --fix", | ||
"eslint --ext ts,tsx --report-unused-disable-directives --fix", | ||
"prettier --write", | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,10 @@ | |
"test": "yarn lerna run test" | ||
}, | ||
"devDependencies": { | ||
"@versini/dev-dependencies-client": "1.1.1" | ||
"@versini/dev-dependencies-client": "1.1.2" | ||
}, | ||
"resolutions": { | ||
"prettier": "3.0.3" | ||
}, | ||
"packageManager": "[email protected]" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** @type { import('@storybook/react-vite').StorybookConfig } */ | ||
|
||
import { dirname, join } from "path"; | ||
|
||
/** | ||
* This function is used to resolve the absolute path of a package. | ||
* It is needed in projects that use Yarn PnP or are set up within a monorepo. | ||
*/ | ||
function getAbsolutePath(value) { | ||
return dirname(require.resolve(join(value, "package.json"))); | ||
} | ||
|
||
const config = { | ||
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"], | ||
addons: [ | ||
getAbsolutePath("@storybook/addon-essentials"), | ||
getAbsolutePath("@storybook/addon-a11y"), | ||
], | ||
framework: { | ||
name: getAbsolutePath("@storybook/react-vite"), | ||
options: {}, | ||
}, | ||
docs: { | ||
autodocs: "tag", | ||
}, | ||
}; | ||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** @type { import('@storybook/react').Preview } */ | ||
|
||
import "../src/index.css"; | ||
import "@versini/ui-components/dist/style.css"; | ||
|
||
const preview = { | ||
parameters: { | ||
actions: { argTypesRegex: "^on[A-Z].*" }, | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/i, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export default preview; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
import { Button } from "@versini/ui-components"; | ||
|
||
const meta: Meta<typeof Button> = { | ||
component: Button, | ||
parameters: { | ||
controls: { exclude: ["spacing"], sort: "requiredFirst" }, | ||
}, | ||
args: { | ||
disabled: false, | ||
fullWidth: false, | ||
kind: "dark", | ||
slim: false, | ||
type: "button", | ||
raw: false, | ||
}, | ||
argTypes: { | ||
className: { | ||
control: "text", | ||
}, | ||
kind: { | ||
options: ["dark", "light"], | ||
control: { type: "radio" }, | ||
}, | ||
slim: { | ||
control: "boolean", | ||
}, | ||
disabled: { | ||
control: "boolean", | ||
}, | ||
fullWidth: { | ||
control: "boolean", | ||
}, | ||
raw: { | ||
control: "boolean", | ||
}, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof Button>; | ||
|
||
export const Basic: Story = { | ||
render: (args) => ( | ||
<div className="flex gap-2"> | ||
<Button {...args}>Button</Button> | ||
<Button {...args}>Button</Button> | ||
<Button {...args}>Button</Button> | ||
<Button {...args}>Button</Button> | ||
</div> | ||
), | ||
}; |
Oops, something went wrong.