@osmn-byhn/storybook-docs 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.storybook/main.js +16 -2
- package/CHANGELOG.md +7 -0
- package/README.md +66 -0
- package/package.json +6 -3
- package/stories/index.js +13 -0
package/.storybook/main.js
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
import path from "path";
|
|
2
|
+
import { fileURLToPath } from "url";
|
|
3
|
+
|
|
4
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
5
|
+
const __dirname = path.dirname(__filename);
|
|
2
6
|
|
|
3
7
|
/** @type { import('@storybook/react-vite').StorybookConfig } */
|
|
4
|
-
|
|
8
|
+
const config = {
|
|
5
9
|
framework: "@storybook/react-vite",
|
|
6
10
|
stories: ["../stories/**/*.stories.@(ts|tsx)"],
|
|
11
|
+
addons: [
|
|
12
|
+
"@storybook/addon-links",
|
|
13
|
+
"@storybook/addon-essentials",
|
|
14
|
+
"@storybook/addon-a11y",
|
|
15
|
+
"@storybook/addon-interactions",
|
|
16
|
+
"@chromatic-com/storybook",
|
|
17
|
+
],
|
|
7
18
|
|
|
8
19
|
viteFinal: async (config) => {
|
|
9
20
|
config.resolve = config.resolve || {};
|
|
@@ -47,3 +58,6 @@ module.exports = {
|
|
|
47
58
|
return config;
|
|
48
59
|
},
|
|
49
60
|
};
|
|
61
|
+
|
|
62
|
+
export default config;
|
|
63
|
+
|
package/CHANGELOG.md
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# @osmn-byhn/storybook-docs
|
|
2
|
+
|
|
3
|
+
The centralized documentation and component playground for the `@osmn-byhn` ecosystem. It uses Storybook to isolate building UI components and verifying their behavior.
|
|
4
|
+
|
|
5
|
+
## Getting Started
|
|
6
|
+
|
|
7
|
+
### Prerequisites
|
|
8
|
+
Ensure you have installed dependencies in the root of the monorepo:
|
|
9
|
+
```bash
|
|
10
|
+
pnpm install
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### Running Storybook
|
|
14
|
+
Start the development server on port 6006:
|
|
15
|
+
```bash
|
|
16
|
+
pnpm run storybook
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Building Static Docs
|
|
20
|
+
Build the static site for deployment:
|
|
21
|
+
```bash
|
|
22
|
+
pnpm run build-storybook
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Writing Stories
|
|
26
|
+
|
|
27
|
+
Stories are located in the `stories/` directory. We use the CSF3 (Component Story Format 3) standard.
|
|
28
|
+
|
|
29
|
+
### Example Story
|
|
30
|
+
Create a new file `stories/MyComponent.stories.tsx`:
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
34
|
+
import { MarkdownEditor } from '@osmn-byhn/mdarea';
|
|
35
|
+
|
|
36
|
+
const meta = {
|
|
37
|
+
title: 'Editor/MarkdownEditor',
|
|
38
|
+
component: MarkdownEditor,
|
|
39
|
+
parameters: {
|
|
40
|
+
layout: 'centered',
|
|
41
|
+
},
|
|
42
|
+
tags: ['autodocs'],
|
|
43
|
+
} satisfies Meta<typeof MarkdownEditor>;
|
|
44
|
+
|
|
45
|
+
export default meta;
|
|
46
|
+
type Story = StoryObj<typeof meta>;
|
|
47
|
+
|
|
48
|
+
export const Default: Story = {
|
|
49
|
+
args: {
|
|
50
|
+
value: '# Hello World',
|
|
51
|
+
placeholder: 'Start typing...',
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Theming
|
|
57
|
+
|
|
58
|
+
We use a custom CSS theme for stories located at `stories/custom-theme.css`.
|
|
59
|
+
To apply global styles or override editor variables in the storybook environment, edit that file.
|
|
60
|
+
|
|
61
|
+
```css
|
|
62
|
+
/* stories/custom-theme.css */
|
|
63
|
+
:root {
|
|
64
|
+
--md-primary-color: #0070f3;
|
|
65
|
+
}
|
|
66
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@osmn-byhn/storybook-docs",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"keywords": [],
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"devDependencies": {
|
|
10
10
|
"react": "^19.2.4",
|
|
11
11
|
"react-dom": "^19.2.4",
|
|
12
|
-
"storybook": "^
|
|
12
|
+
"storybook": "^10.2.3",
|
|
13
13
|
"@storybook/react-vite": "^10.2.3",
|
|
14
14
|
"@chromatic-com/storybook": "^5.0.0",
|
|
15
15
|
"@storybook/addon-vitest": "^10.2.3",
|
|
@@ -20,7 +20,10 @@
|
|
|
20
20
|
"playwright": "^1.58.1",
|
|
21
21
|
"@vitest/browser-playwright": "^4.0.18",
|
|
22
22
|
"@vitest/coverage-v8": "^4.0.18",
|
|
23
|
-
"@
|
|
23
|
+
"@storybook/react": "^10.2.4",
|
|
24
|
+
"@storybook/addon-actions": "^9.0.8",
|
|
25
|
+
"@storybook/addon-links": "^10.2.4",
|
|
26
|
+
"@osmn-byhn/mdarea": "0.0.5"
|
|
24
27
|
},
|
|
25
28
|
"scripts": {
|
|
26
29
|
"test": "echo \"Error: no test specified\" && exit 1",
|
package/stories/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { storiesOf } from '@storybook/react';
|
|
4
|
+
import { action } from '@storybook/addon-actions';
|
|
5
|
+
import { linkTo } from '@storybook/addon-links';
|
|
6
|
+
|
|
7
|
+
import { Button, Welcome } from '@storybook/react/demo';
|
|
8
|
+
|
|
9
|
+
storiesOf('Welcome', module).add('to Storybook', () => <Welcome showApp={linkTo('Button')} />);
|
|
10
|
+
|
|
11
|
+
storiesOf('Button', module)
|
|
12
|
+
.add('with text', () => <Button onClick={action('clicked')}>Hello Button</Button>)
|
|
13
|
+
.add('with some emoji', () => <Button onClick={action('clicked')}>😀 😎 👍 💯</Button>);
|