Fix missing react-demo

This commit is contained in:
Michael Shilman 2022-04-12 14:59:21 +08:00
parent dd15eebc2c
commit 32e73c89bf
28 changed files with 236 additions and 23 deletions

View File

@ -0,0 +1,34 @@
import React from 'react';
const styles = {
border: '1px solid #eee',
borderRadius: 3,
backgroundColor: '#FFFFFF',
cursor: 'pointer',
fontSize: 15,
padding: '3px 10px',
margin: 10,
};
// eslint-disable-next-line react/prop-types
export const Button = ({ children, onClick }) => (
<button onClick={onClick} style={styles} type="button">
{children}
</button>
);
Button.displayName = 'Button';
Button.defaultProps = {
onClick: () => {},
};
// eslint-disable-next-line react/prop-types
export const Welcome = ({ showApp }) => (
<button type="button" onClick={showApp}>
Welcome
</button>
);
Welcome.displayName = 'Welcome';
Welcome.defaultProps = {
showApp: () => {},
};

View File

@ -1,7 +1,7 @@
import React from 'react';
import { action } from '@storybook/addon-actions';
import { Button } from '@storybook/react/demo';
import { Button } from '../react-demo';
export default {
title: 'Button',

View File

@ -1,7 +1,7 @@
import React from 'react';
import { linkTo } from '@storybook/addon-links';
import { Welcome } from '@storybook/react/demo';
import { Welcome } from '../react-demo';
export default {
title: 'Welcome',

View File

@ -1,5 +1,5 @@
import { linkTo } from '@storybook/addon-links';
import { Welcome } from '@storybook/react/demo';
import { Welcome } from '../react-demo';
import { Meta, Story } from '@storybook/addon-docs';
<Meta

View File

@ -0,0 +1,34 @@
import React from 'react';
const styles = {
border: '1px solid #eee',
borderRadius: 3,
backgroundColor: '#FFFFFF',
cursor: 'pointer',
fontSize: 15,
padding: '3px 10px',
margin: 10,
};
// eslint-disable-next-line react/prop-types
export const Button = ({ children, onClick }) => (
<button onClick={onClick} style={styles} type="button">
{children}
</button>
);
Button.displayName = 'Button';
Button.defaultProps = {
onClick: () => {},
};
// eslint-disable-next-line react/prop-types
export const Welcome = ({ showApp }) => (
<button type="button" onClick={showApp}>
Welcome
</button>
);
Welcome.displayName = 'Welcome';
Welcome.defaultProps = {
showApp: () => {},
};

View File

@ -1,6 +1,6 @@
import React from 'react';
import { action } from '@storybook/addon-actions';
import { Button } from '@storybook/react/demo';
import { Button } from '../components/react-demo';
export default {
title: 'Button',

View File

@ -9,7 +9,7 @@ export default {
export const Story1 = () => {
if (!Component) {
import('@storybook/react/demo').then(({ Button }) => {
import('../components/react-demo').then(({ Button }) => {
Component = Button;
forceReRender();
});

View File

@ -1,7 +1,7 @@
import React from 'react';
import { action } from '@storybook/addon-actions';
import { Button } from '@storybook/react/demo';
import PropTypes from 'prop-types';
import { Button } from '../components/react-demo';
const Bold = ({ children }) => {
return <b>{children}</b>;

View File

@ -1,6 +1,6 @@
import React from 'react';
import { forceReRender } from '@storybook/react';
import { Button } from '@storybook/react/demo';
import { Button } from '../components/react-demo';
let count = 0;
const increment = () => {

View File

@ -1,6 +1,6 @@
import React from 'react';
import { action } from '@storybook/addon-actions';
import { Button } from '@storybook/react/demo';
import { Button } from '../components/react-demo';
export default {
title: 'Some really long story kind description',

View File

@ -1,6 +1,6 @@
import React from 'react';
import { Welcome } from '@storybook/react/demo';
import { linkTo } from '@storybook/addon-links';
import { Welcome } from '../components/react-demo';
export default {
title: 'Welcome',

View File

@ -1,6 +1,6 @@
import React from 'react';
import { action } from '@storybook/addon-actions';
import { Button } from '@storybook/react/demo';
import { Button } from './react-demo';
export default {
title: 'Button',

View File

@ -0,0 +1,34 @@
import React from 'react';
const styles = {
border: '1px solid #eee',
borderRadius: 3,
backgroundColor: '#FFFFFF',
cursor: 'pointer',
fontSize: 15,
padding: '3px 10px',
margin: 10,
};
// eslint-disable-next-line react/prop-types
export const Button = ({ children, onClick }) => (
<button onClick={onClick} style={styles} type="button">
{children}
</button>
);
Button.displayName = 'Button';
Button.defaultProps = {
onClick: () => {},
};
// eslint-disable-next-line react/prop-types
export const Welcome = ({ showApp }) => (
<button type="button" onClick={showApp}>
Welcome
</button>
);
Welcome.displayName = 'Welcome';
Welcome.defaultProps = {
showApp: () => {},
};

View File

@ -1,7 +1,7 @@
import React from 'react';
import { storiesOf, setAddon } from '@storybook/react';
import { linkTo } from '@storybook/addon-links';
import { Welcome } from '@storybook/react/demo';
import { Welcome } from './react-demo';
// Added deprecated setAddon tests
setAddon({

View File

@ -1,7 +1,7 @@
import React from 'react';
import { linkTo } from '@storybook/addon-links';
import { Welcome } from '@storybook/react/demo';
import type { ComponentMeta, ComponentStory } from '@storybook/react';
import { Welcome } from './react-demo';
export default {
title: 'Welcome',

View File

@ -1,6 +1,6 @@
import React from 'react';
import { Button } from '@storybook/react/demo';
import type { ComponentStory, ComponentMeta } from '@storybook/react';
import { Button } from './react-demo';
export default {
title: 'Button',

View File

@ -0,0 +1,37 @@
import React, { FC, HTMLAttributes } from 'react';
const styles = {
border: '1px solid #eee',
borderRadius: 3,
backgroundColor: '#FFFFFF',
cursor: 'pointer',
fontSize: 15,
padding: '3px 10px',
margin: 10,
};
type ButtonProps = Pick<HTMLAttributes<HTMLButtonElement>, 'onClick'>;
export const Button: FC<ButtonProps> = ({ children, onClick }) => (
<button onClick={onClick} style={styles} type="button">
{children}
</button>
);
Button.displayName = 'Button';
Button.defaultProps = {
onClick: () => {},
};
interface WelcomeProps {
showApp: () => void;
}
export const Welcome: FC<WelcomeProps> = ({ showApp }) => (
<button type="button" onClick={showApp}>
Welcome
</button>
);
Welcome.displayName = 'Welcome';
Welcome.defaultProps = {
showApp: () => {},
};

View File

@ -0,0 +1,37 @@
import React, { FC, HTMLAttributes } from 'react';
const styles = {
border: '1px solid #eee',
borderRadius: 3,
backgroundColor: '#FFFFFF',
cursor: 'pointer',
fontSize: 15,
padding: '3px 10px',
margin: 10,
};
type ButtonProps = Pick<HTMLAttributes<HTMLButtonElement>, 'onClick'>;
export const Button: FC<ButtonProps> = ({ children, onClick }) => (
<button onClick={onClick} style={styles} type="button">
{children}
</button>
);
Button.displayName = 'Button';
Button.defaultProps = {
onClick: () => {},
};
interface WelcomeProps {
showApp: () => void;
}
export const Welcome: FC<WelcomeProps> = ({ showApp }) => (
<button type="button" onClick={showApp}>
Welcome
</button>
);
Welcome.displayName = 'Welcome';
Welcome.defaultProps = {
showApp: () => {},
};

View File

@ -1,6 +1,6 @@
import React from 'react';
import { linkTo } from '@storybook/addon-links';
import { Welcome } from '@storybook/react/demo';
import { Welcome } from '../components/react-demo';
export default {
title: 'Welcome',

View File

@ -0,0 +1,37 @@
import React, { FC, HTMLAttributes } from 'react';
const styles = {
border: '1px solid #eee',
borderRadius: 3,
backgroundColor: '#FFFFFF',
cursor: 'pointer',
fontSize: 15,
padding: '3px 10px',
margin: 10,
};
type ButtonProps = Pick<HTMLAttributes<HTMLButtonElement>, 'onClick'>;
export const Button: FC<ButtonProps> = ({ children, onClick }) => (
<button onClick={onClick} style={styles} type="button">
{children}
</button>
);
Button.displayName = 'Button';
Button.defaultProps = {
onClick: () => {},
};
interface WelcomeProps {
showApp: () => void;
}
export const Welcome: FC<WelcomeProps> = ({ showApp }) => (
<button type="button" onClick={showApp}>
Welcome
</button>
);
Welcome.displayName = 'Welcome';
Welcome.defaultProps = {
showApp: () => {},
};

View File

@ -9,8 +9,8 @@ import {
Meta,
} from '@storybook/addon-docs';
import { action } from '@storybook/addon-actions';
import { Button } from '@storybook/react/demo';
import styled from 'styled-components';
import { Button } from '../../components/react-demo';
import TsButton from '../../components/TsButton';
import FlowTypeButton from '../../components/FlowTypeButton';
import { DocgenButton } from '../../components/DocgenButton';

View File

@ -1,6 +1,6 @@
/* eslint-disable storybook/default-exports */
import React from 'react';
import { Button } from '@storybook/react/demo';
import { Button } from '../../components/react-demo';
// NOTE: commented out default since these stories are re-exported
// in the primary file './csf-docs-with-mdx-docs.stories.mdx'

View File

@ -1,5 +1,5 @@
import React from 'react';
import { Button } from '@storybook/react/demo';
import { Button } from '../../components/react-demo';
export default { title: 'Addons/Docs/Imported', component: Button };
export const Basic = (args: any) => <Button {...args} />;

View File

@ -7,10 +7,10 @@ export default {
parameters: { chromatic: { disable: true } },
};
import { Welcome } from '@storybook/react/demo';
import { Welcome } from '../../components/react-demo';
export const First = () => <Welcome showApp={action('show')} />;
import { Button } from '@storybook/react/demo';
import { Button } from '../../components/react-demo';
export const Second = () => <Button onClick={action('click')}>Second</Button>;

View File

@ -1,5 +1,5 @@
import { Meta, Canvas, Story } from '@storybook/addon-docs';
import { Button } from '@storybook/react/demo';
import { Button } from '../../components/react-demo';
<Meta
title="Core/Layout MDX"

View File

@ -1,6 +1,6 @@
import React, { useState } from 'react';
import { action } from '@storybook/addon-actions';
import { Button } from '@storybook/react/demo';
import { Button } from '../../components/react-demo';
export default {
title: 'Other/Demo/Button',

View File

@ -1,7 +1,7 @@
import { useState } from 'react';
import { action } from '@storybook/addon-actions';
import { Button } from '@storybook/react/demo';
import { Meta, Story, Canvas, ArgsTable } from '@storybook/addon-docs';
import { Button } from '../../compoenents/react-demo';
<Meta title="Other/Demo/ButtonMdx" component={Button} />

View File

@ -1,6 +1,6 @@
import React from 'react';
import { linkTo } from '@storybook/addon-links';
import { Welcome } from '@storybook/react/demo';
import { Welcome } from '../../components/react-demo';
export default {
title: 'Other/Demo/Welcome',