Skip to content

Commit

Permalink
Reproduce issue
Browse files Browse the repository at this point in the history
  • Loading branch information
vinassefranche committed May 3, 2021
1 parent 60d45e7 commit fa6a7de
Show file tree
Hide file tree
Showing 9 changed files with 11,261 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
esm
24 changes: 24 additions & 0 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module.exports = {
addons: [
'@storybook/addon-knobs',
'@storybook/addon-docs',
'@storybook/addon-controls',
'@storybook/addon-viewport/register',
],
features: {
postcss: false,
},
stories: ['../src/**/*.stories.@(tsx|mdx)'],
webpackFinal: async config => {
config.module.rules.push({
test: /\.(ts|tsx)$/,
use: [
{
loader: require.resolve('ts-loader'),
},
],
});
config.resolve.extensions.push('.ts', '.tsx');
return config;
},
};
24 changes: 24 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "storybook-issue",
"version": "1.0.0",
"repository": {
"type": "git",
"url": "ssh://[email protected]/vinassefranche/storybook-issue.git"
},
"scripts": {
"start": "start-storybook -p 6061"
},
"dependencies": {
"@types/react": "^16.9.44",
"@types/storybook__addon-info": "^5.2.3",
"typescript": "4.2.3",
"@storybook/addon-controls": "^6.2.9",
"@storybook/addon-docs": "^6.2.9",
"@storybook/addon-knobs": "^6.2.9",
"@storybook/addon-viewport": "^6.2.9",
"@storybook/react": "^6.2.9",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"ts-loader": "^8.0.2"
}
}
17 changes: 17 additions & 0 deletions src/MyComponent.stories.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Meta, Story, Canvas } from "@storybook/addon-docs/blocks";
import { MyComponent } from "./MyComponent";
import { Playground } from "./MyComponent.stories.tsx";

<Meta title="Components/MyComponent" component={MyComponent} />

# MyComponent

Displays MyComponent

## Playground

Experiment with `MyComponent` properties in Canvas tab.

<Story name="playground">
<Playground />
</Story>
18 changes: 18 additions & 0 deletions src/MyComponent.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Story } from '@storybook/react';
import React from 'react';

import { MyComponent, MyComponentProps } from './MyComponent';

export default {
title: 'Components/MyComponent',
component: MyComponent,
parameters: {
knobs: {
disabled: true,
},
},
};

const Template: Story<MyComponentProps> = props => (<MyComponent {...props}/>);

export const Playground = Template.bind({});
18 changes: 18 additions & 0 deletions src/MyComponent.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react';

export enum Test {
test1 = 'test1',
}

const mapping = {
[Test.test1]: {
data: 'data for test1'
},
};

export type MyComponentProps = {
someProp?: Test;
}

export const MyComponent = ({someProp}: MyComponentProps) =>
(<div>Component {someProp && mapping[someProp].data}</div>)
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./MyComponent";
30 changes: 30 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"compilerOptions": {
"rootDir": "src",
"skipLibCheck": true,
"outDir": "esm",
"module": "esnext",
"target": "es5",
"jsx": "react",
"lib": ["dom", "esnext"],
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"allowJs": true,
"strict": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"sourceMap": true,
"inlineSources": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"forceConsistentCasingInFileNames": true,
"noEmit": false,
"noImplicitAny": true,
"declaration": true
},
"include": ["src", "typings", "danger"],
"exclude": ["danger"]
}
Loading

0 comments on commit fa6a7de

Please sign in to comment.