mirror of
https://github.com/zhigang1992/bug-free-fiesta.git
synced 2026-04-30 19:51:52 +08:00
attempt on reproduce the error
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
const path = require("path");
|
||||
|
||||
module.exports = {
|
||||
stories: ["../src/stories/**/*.stories.(ts|tsx|js|jsx)"],
|
||||
stories: ["../src/**/*.stories.(ts|tsx|js|jsx)"],
|
||||
addons: [
|
||||
"@storybook/addon-actions",
|
||||
"@storybook/addon-links",
|
||||
|
||||
12
src/App.tsx
12
src/App.tsx
@@ -6,21 +6,13 @@ const App: React.FC = () => {
|
||||
return (
|
||||
<div className="App">
|
||||
<header className="App-header">
|
||||
<img src={logo} className="App-logo" alt="logo" />
|
||||
<img src={logo} className="App-logo" alt="logo"/>
|
||||
<p>
|
||||
Edit <code>src/App.tsx</code> and save to reload.
|
||||
</p>
|
||||
<a
|
||||
className="App-link"
|
||||
href="https://reactjs.org"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Learn React
|
||||
</a>
|
||||
</header>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
export default App;
|
||||
|
||||
35
src/AwesomeButton.stories.tsx
Normal file
35
src/AwesomeButton.stories.tsx
Normal file
@@ -0,0 +1,35 @@
|
||||
import React from "react";
|
||||
import {select, withKnobs} from "@storybook/addon-knobs";
|
||||
import AwesomeButton, {AwesomeButtonProps} from "./AwesomeButton";
|
||||
|
||||
export default {
|
||||
title: "AwesomeButton",
|
||||
component: AwesomeButton,
|
||||
decorators: [withKnobs]
|
||||
};
|
||||
|
||||
export const Single = () => {
|
||||
const type = select<AwesomeButtonProps['type']>(
|
||||
"Type",
|
||||
['Awesome', 'Cool', 'Sup'],
|
||||
"Awesome"
|
||||
);
|
||||
return (
|
||||
<div className="flex">
|
||||
<AwesomeButton type={type}/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export const Multiple = () => {
|
||||
const type = select<AwesomeButtonProps['type']>(
|
||||
"Type",
|
||||
['Awesome', 'Cool', 'Sup'],
|
||||
"Cool"
|
||||
);
|
||||
return (
|
||||
<div className="flex">
|
||||
<AwesomeButton type={type}/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
11
src/AwesomeButton.tsx
Normal file
11
src/AwesomeButton.tsx
Normal file
@@ -0,0 +1,11 @@
|
||||
import React from "react";
|
||||
|
||||
export interface AwesomeButtonProps {
|
||||
type: 'Awesome' | 'Cool' | 'Sup'
|
||||
}
|
||||
|
||||
const AwesomeButton = (props: AwesomeButtonProps) => {
|
||||
return <div>{props.type}</div>
|
||||
};
|
||||
|
||||
export default AwesomeButton
|
||||
@@ -1,14 +0,0 @@
|
||||
import React from 'react';
|
||||
import { linkTo } from '@storybook/addon-links';
|
||||
import { Welcome } from '@storybook/react/demo';
|
||||
|
||||
export default {
|
||||
title: 'Welcome',
|
||||
component: Welcome,
|
||||
};
|
||||
|
||||
export const ToStorybook = () => <Welcome showApp={linkTo('Button')} />;
|
||||
|
||||
ToStorybook.story = {
|
||||
name: 'to Storybook',
|
||||
};
|
||||
@@ -1,20 +0,0 @@
|
||||
import React from 'react';
|
||||
import { action } from '@storybook/addon-actions';
|
||||
import { Button } from '@storybook/react/demo';
|
||||
|
||||
import '../testFails.css';
|
||||
|
||||
export const Text = () => <div className="testClass"/>;
|
||||
|
||||
export const Emoji = () => (
|
||||
<Button onClick={action('clicked')}>
|
||||
<span role="img" aria-label="so cool">
|
||||
😀 😎
|
||||
</span>
|
||||
</Button>
|
||||
);
|
||||
|
||||
export default {
|
||||
title: 'Button',
|
||||
component: Button,
|
||||
};
|
||||
Reference in New Issue
Block a user