-
Notifications
You must be signed in to change notification settings - Fork 3
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 #5 from PxTools/PXWEB2-27-install-and-setup-storybook
Pxweb2-27 install and setup storybook
- Loading branch information
Showing
12 changed files
with
18,879 additions
and
5,622 deletions.
There are no files selected for viewing
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
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,20 @@ | ||
import type { StorybookConfig } from '@storybook/react-vite'; | ||
|
||
const config: StorybookConfig = { | ||
stories: ['../src/lib/**/*.stories.@(js|jsx|ts|tsx|mdx)'], | ||
addons: ['@storybook/addon-essentials', '@storybook/addon-interactions'], | ||
framework: { | ||
name: '@storybook/react-vite', | ||
options: { | ||
builder: { | ||
viteConfigPath: 'libs/pxweb2-ui/vite.config.ts', | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export default config; | ||
|
||
// To customize your Vite configuration you can use the viteFinal field. | ||
// Check https://storybook.js.org/docs/react/builders/vite#configuration | ||
// and https://nx.dev/recipes/storybook/custom-builder-configs |
Empty file.
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
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,38 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { Pxweb2Ui } from './pxweb2-ui'; | ||
|
||
import { within } from '@storybook/testing-library'; | ||
import { expect } from '@storybook/jest'; | ||
|
||
const meta: Meta<typeof Pxweb2Ui> = { | ||
component: Pxweb2Ui, | ||
title: 'Pxweb2Ui', | ||
}; | ||
export default meta; | ||
type Story = StoryObj<typeof Pxweb2Ui>; | ||
|
||
export const Primary = { | ||
args: { | ||
title: 'pxweb2-ui primary!', | ||
variant: 'primary', | ||
}, | ||
}; | ||
|
||
export const Secondary: Story = { | ||
args: { | ||
title: 'pxweb2-ui secondary!', | ||
variant: 'secondary', | ||
}, | ||
play: async ({ canvasElement }) => { | ||
const canvas = within(canvasElement); | ||
expect(canvas.getByText(/pxweb2-ui secondary!/gi)).toBeTruthy(); | ||
}, | ||
}; | ||
|
||
export const Heading: Story = { | ||
args: {}, | ||
play: async ({ canvasElement }) => { | ||
const canvas = within(canvasElement); | ||
expect(canvas.getByText(/Welcome to Pxweb2Ui!/gi)).toBeTruthy(); | ||
}, | ||
}; |
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
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
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
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,31 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"emitDecoratorMetadata": true, | ||
"outDir": "" | ||
}, | ||
"files": [ | ||
"../../node_modules/@nx/react/typings/styled-jsx.d.ts", | ||
"../../node_modules/@nx/react/typings/cssmodule.d.ts", | ||
"../../node_modules/@nx/react/typings/image.d.ts" | ||
], | ||
"exclude": [ | ||
"src/**/*.spec.ts", | ||
"src/**/*.test.ts", | ||
"src/**/*.spec.js", | ||
"src/**/*.test.js", | ||
"src/**/*.spec.tsx", | ||
"src/**/*.test.tsx", | ||
"src/**/*.spec.jsx", | ||
"src/**/*.test.js" | ||
], | ||
"include": [ | ||
"src/**/*.stories.ts", | ||
"src/**/*.stories.js", | ||
"src/**/*.stories.jsx", | ||
"src/**/*.stories.tsx", | ||
"src/**/*.stories.mdx", | ||
".storybook/*.js", | ||
".storybook/*.ts" | ||
] | ||
} |
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
Oops, something went wrong.